forked from Imagelibrary/rtems
Patch from Eric Valette <valette@crf.canon.fr> which brings the i386ex BSP
inline with the new IRQ structure.
This commit is contained in:
@@ -109,444 +109,6 @@ SYM (_CPU_Context_restore_fp):
|
||||
frstor (eax) # restore FP context
|
||||
ret
|
||||
|
||||
/*PAGE
|
||||
* void _ISR_Handler()
|
||||
*
|
||||
* This routine provides the RTEMS interrupt management.
|
||||
*
|
||||
* NOTE:
|
||||
* Upon entry, the stack will contain a stack frame back to the
|
||||
* interrupted task. If dispatching is enabled, this is the
|
||||
* outer most interrupt, and (a context switch is necessary or
|
||||
* the current task has signals), then set up the stack to
|
||||
* transfer control to the interrupt dispatcher.
|
||||
*/
|
||||
|
||||
.set SET_SEGMENT_REGISTERS_IN_INTERRUPT, 0
|
||||
|
||||
.set SAVED_REGS , 32 # space consumed by saved regs
|
||||
.set EIP_OFFSET , SAVED_REGS # offset of tasks eip
|
||||
.set CS_OFFSET , EIP_OFFSET+4 # offset of tasks code segment
|
||||
.set EFLAGS_OFFSET , CS_OFFSET+4 # offset of tasks eflags
|
||||
|
||||
.p2align 1
|
||||
PUBLIC (_ISR_Handler)
|
||||
|
||||
SYM (_ISR_Handler):
|
||||
/*
|
||||
* Before this was point is reached the vectors unique
|
||||
* entry point did the following:
|
||||
*
|
||||
* 1. saved all registers with a "pusha"
|
||||
* 2. put the vector number in eax.
|
||||
*
|
||||
* BEGINNING OF ESTABLISH SEGMENTS
|
||||
*
|
||||
* WARNING: If an interrupt can occur when the segments are
|
||||
* not correct, then this is where we should establish
|
||||
* the segments. In addition to establishing the
|
||||
* segments, it may be necessary to establish a stack
|
||||
* in the current data area on the outermost interrupt.
|
||||
*
|
||||
* NOTE: If the previous values of the segment registers are
|
||||
* pushed, do not forget to adjust SAVED_REGS.
|
||||
*
|
||||
* NOTE: Make sure the exit code which restores these
|
||||
* when this type of code is needed.
|
||||
*/
|
||||
|
||||
/***** ESTABLISH SEGMENTS CODE GOES HERE ******/
|
||||
|
||||
/*
|
||||
* END OF ESTABLISH SEGMENTS
|
||||
*/
|
||||
|
||||
/*
|
||||
* Now switch stacks if necessary
|
||||
*/
|
||||
|
||||
movl esp, edx # edx = previous stack pointer
|
||||
cmpl $0, SYM (_ISR_Nest_level) # is this the outermost interrupt?
|
||||
jne nested # No, then continue
|
||||
movl SYM (_CPU_Interrupt_stack_high), esp
|
||||
|
||||
/*
|
||||
* We want to insure that the old stack pointer is on the
|
||||
* stack we will be on at the end of the ISR when we restore it.
|
||||
* By saving it on every interrupt, all we have to do is pop it
|
||||
* near the end of every interrupt.
|
||||
*/
|
||||
|
||||
nested:
|
||||
pushl edx # save the previous stack pointer
|
||||
incl SYM (_ISR_Nest_level) # one nest level deeper
|
||||
incl SYM (_Thread_Dispatch_disable_level) # disable multitasking
|
||||
|
||||
# EAX is preloaded with the vector number.
|
||||
push eax # push vector number
|
||||
mov SYM (_ISR_Vector_table) (,eax,4),eax
|
||||
# eax = Users handler
|
||||
call eax # invoke user ISR
|
||||
pop eax # eax = vector number
|
||||
|
||||
decl SYM (_ISR_Nest_level) # one less ISR nest level
|
||||
# If interrupts are nested,
|
||||
# then dispatching is disabled
|
||||
|
||||
decl SYM (_Thread_Dispatch_disable_level)
|
||||
# unnest multitasking
|
||||
# Is dispatch disabled
|
||||
jne exit # Yes, then exit
|
||||
|
||||
cmpl $0, SYM (_Context_Switch_necessary)
|
||||
# Is task switch necessary?
|
||||
jne bframe # Yes, then build stack
|
||||
|
||||
cmpl $0, SYM (_ISR_Signals_to_thread_executing)
|
||||
# signals sent to Run_thread
|
||||
# while in interrupt handler?
|
||||
je exit # No, exit
|
||||
|
||||
bframe:
|
||||
cli # DISABLE INTERRUPTS!!
|
||||
popl esp # restore the stack pointer
|
||||
movl $0, SYM (_ISR_Signals_to_thread_executing)
|
||||
# push the isf for Isr_dispatch
|
||||
push EFLAGS_OFFSET(esp) # push tasks eflags
|
||||
push cs # cs of Isr_dispatch
|
||||
push $ SYM (_ISR_Dispatch) # entry point
|
||||
iret
|
||||
|
||||
exit:
|
||||
cli # DISABLE INTERRUPTS!!
|
||||
popl esp # restore the stack pointer
|
||||
|
||||
/*
|
||||
* BEGINNING OF DE-ESTABLISH SEGMENTS
|
||||
*
|
||||
* NOTE: Make sure there is code here if code is added to
|
||||
* load the segment registers.
|
||||
*
|
||||
*/
|
||||
|
||||
/******* DE-ESTABLISH SEGMENTS CODE GOES HERE ********/
|
||||
|
||||
/*
|
||||
* END OF DE-ESTABLISH SEGMENTS
|
||||
*/
|
||||
|
||||
popa # restore general registers
|
||||
iret
|
||||
|
||||
/*PAGE
|
||||
* Distinct Interrupt Entry Points
|
||||
*
|
||||
* The following macro and the 256 instantiations of the macro
|
||||
* are necessary to determine which interrupt vector occurred.
|
||||
* The following macro allows a unique entry point to be defined
|
||||
* for each vector.
|
||||
*
|
||||
* NOTE: There are not spaces around the vector number argument
|
||||
* to the DISTINCT_INTERRUPT_ENTRY macro because m4 will
|
||||
* undesirably generate the symbol "_Isr_handler_ N"
|
||||
* instead of "_Isr_handler_N" like we want.
|
||||
*/
|
||||
|
||||
#define DISTINCT_INTERRUPT_ENTRY(_vector) \
|
||||
.p2align 4 ; \
|
||||
PUBLIC (_ISR_Handler_ ## _vector ) ; \
|
||||
SYM (_ISR_Handler_ ## _vector ): \
|
||||
pusha ; \
|
||||
xor eax, eax ; \
|
||||
movb $ ## _vector, al ; \
|
||||
jmp SYM (_ISR_Handler) ;
|
||||
|
||||
DISTINCT_INTERRUPT_ENTRY(0)
|
||||
DISTINCT_INTERRUPT_ENTRY(1)
|
||||
DISTINCT_INTERRUPT_ENTRY(2)
|
||||
DISTINCT_INTERRUPT_ENTRY(3)
|
||||
DISTINCT_INTERRUPT_ENTRY(4)
|
||||
DISTINCT_INTERRUPT_ENTRY(5)
|
||||
DISTINCT_INTERRUPT_ENTRY(6)
|
||||
DISTINCT_INTERRUPT_ENTRY(7)
|
||||
DISTINCT_INTERRUPT_ENTRY(8)
|
||||
DISTINCT_INTERRUPT_ENTRY(9)
|
||||
DISTINCT_INTERRUPT_ENTRY(10)
|
||||
DISTINCT_INTERRUPT_ENTRY(11)
|
||||
DISTINCT_INTERRUPT_ENTRY(12)
|
||||
DISTINCT_INTERRUPT_ENTRY(13)
|
||||
DISTINCT_INTERRUPT_ENTRY(14)
|
||||
DISTINCT_INTERRUPT_ENTRY(15)
|
||||
DISTINCT_INTERRUPT_ENTRY(16)
|
||||
DISTINCT_INTERRUPT_ENTRY(17)
|
||||
DISTINCT_INTERRUPT_ENTRY(18)
|
||||
DISTINCT_INTERRUPT_ENTRY(19)
|
||||
DISTINCT_INTERRUPT_ENTRY(20)
|
||||
DISTINCT_INTERRUPT_ENTRY(21)
|
||||
DISTINCT_INTERRUPT_ENTRY(22)
|
||||
DISTINCT_INTERRUPT_ENTRY(23)
|
||||
DISTINCT_INTERRUPT_ENTRY(24)
|
||||
DISTINCT_INTERRUPT_ENTRY(25)
|
||||
DISTINCT_INTERRUPT_ENTRY(26)
|
||||
DISTINCT_INTERRUPT_ENTRY(27)
|
||||
DISTINCT_INTERRUPT_ENTRY(28)
|
||||
DISTINCT_INTERRUPT_ENTRY(29)
|
||||
DISTINCT_INTERRUPT_ENTRY(30)
|
||||
DISTINCT_INTERRUPT_ENTRY(31)
|
||||
DISTINCT_INTERRUPT_ENTRY(32)
|
||||
DISTINCT_INTERRUPT_ENTRY(33)
|
||||
DISTINCT_INTERRUPT_ENTRY(34)
|
||||
DISTINCT_INTERRUPT_ENTRY(35)
|
||||
DISTINCT_INTERRUPT_ENTRY(36)
|
||||
DISTINCT_INTERRUPT_ENTRY(37)
|
||||
DISTINCT_INTERRUPT_ENTRY(38)
|
||||
DISTINCT_INTERRUPT_ENTRY(39)
|
||||
DISTINCT_INTERRUPT_ENTRY(40)
|
||||
DISTINCT_INTERRUPT_ENTRY(41)
|
||||
DISTINCT_INTERRUPT_ENTRY(42)
|
||||
DISTINCT_INTERRUPT_ENTRY(43)
|
||||
DISTINCT_INTERRUPT_ENTRY(44)
|
||||
DISTINCT_INTERRUPT_ENTRY(45)
|
||||
DISTINCT_INTERRUPT_ENTRY(46)
|
||||
DISTINCT_INTERRUPT_ENTRY(47)
|
||||
DISTINCT_INTERRUPT_ENTRY(48)
|
||||
DISTINCT_INTERRUPT_ENTRY(49)
|
||||
DISTINCT_INTERRUPT_ENTRY(50)
|
||||
DISTINCT_INTERRUPT_ENTRY(51)
|
||||
DISTINCT_INTERRUPT_ENTRY(52)
|
||||
DISTINCT_INTERRUPT_ENTRY(53)
|
||||
DISTINCT_INTERRUPT_ENTRY(54)
|
||||
DISTINCT_INTERRUPT_ENTRY(55)
|
||||
DISTINCT_INTERRUPT_ENTRY(56)
|
||||
DISTINCT_INTERRUPT_ENTRY(57)
|
||||
DISTINCT_INTERRUPT_ENTRY(58)
|
||||
DISTINCT_INTERRUPT_ENTRY(59)
|
||||
DISTINCT_INTERRUPT_ENTRY(60)
|
||||
DISTINCT_INTERRUPT_ENTRY(61)
|
||||
DISTINCT_INTERRUPT_ENTRY(62)
|
||||
DISTINCT_INTERRUPT_ENTRY(63)
|
||||
DISTINCT_INTERRUPT_ENTRY(64)
|
||||
DISTINCT_INTERRUPT_ENTRY(65)
|
||||
DISTINCT_INTERRUPT_ENTRY(66)
|
||||
DISTINCT_INTERRUPT_ENTRY(67)
|
||||
DISTINCT_INTERRUPT_ENTRY(68)
|
||||
DISTINCT_INTERRUPT_ENTRY(69)
|
||||
DISTINCT_INTERRUPT_ENTRY(70)
|
||||
DISTINCT_INTERRUPT_ENTRY(71)
|
||||
DISTINCT_INTERRUPT_ENTRY(72)
|
||||
DISTINCT_INTERRUPT_ENTRY(73)
|
||||
DISTINCT_INTERRUPT_ENTRY(74)
|
||||
DISTINCT_INTERRUPT_ENTRY(75)
|
||||
DISTINCT_INTERRUPT_ENTRY(76)
|
||||
DISTINCT_INTERRUPT_ENTRY(77)
|
||||
DISTINCT_INTERRUPT_ENTRY(78)
|
||||
DISTINCT_INTERRUPT_ENTRY(79)
|
||||
DISTINCT_INTERRUPT_ENTRY(80)
|
||||
DISTINCT_INTERRUPT_ENTRY(81)
|
||||
DISTINCT_INTERRUPT_ENTRY(82)
|
||||
DISTINCT_INTERRUPT_ENTRY(83)
|
||||
DISTINCT_INTERRUPT_ENTRY(84)
|
||||
DISTINCT_INTERRUPT_ENTRY(85)
|
||||
DISTINCT_INTERRUPT_ENTRY(86)
|
||||
DISTINCT_INTERRUPT_ENTRY(87)
|
||||
DISTINCT_INTERRUPT_ENTRY(88)
|
||||
DISTINCT_INTERRUPT_ENTRY(89)
|
||||
DISTINCT_INTERRUPT_ENTRY(90)
|
||||
DISTINCT_INTERRUPT_ENTRY(91)
|
||||
DISTINCT_INTERRUPT_ENTRY(92)
|
||||
DISTINCT_INTERRUPT_ENTRY(93)
|
||||
DISTINCT_INTERRUPT_ENTRY(94)
|
||||
DISTINCT_INTERRUPT_ENTRY(95)
|
||||
DISTINCT_INTERRUPT_ENTRY(96)
|
||||
DISTINCT_INTERRUPT_ENTRY(97)
|
||||
DISTINCT_INTERRUPT_ENTRY(98)
|
||||
DISTINCT_INTERRUPT_ENTRY(99)
|
||||
DISTINCT_INTERRUPT_ENTRY(100)
|
||||
DISTINCT_INTERRUPT_ENTRY(101)
|
||||
DISTINCT_INTERRUPT_ENTRY(102)
|
||||
DISTINCT_INTERRUPT_ENTRY(103)
|
||||
DISTINCT_INTERRUPT_ENTRY(104)
|
||||
DISTINCT_INTERRUPT_ENTRY(105)
|
||||
DISTINCT_INTERRUPT_ENTRY(106)
|
||||
DISTINCT_INTERRUPT_ENTRY(107)
|
||||
DISTINCT_INTERRUPT_ENTRY(108)
|
||||
DISTINCT_INTERRUPT_ENTRY(109)
|
||||
DISTINCT_INTERRUPT_ENTRY(110)
|
||||
DISTINCT_INTERRUPT_ENTRY(111)
|
||||
DISTINCT_INTERRUPT_ENTRY(112)
|
||||
DISTINCT_INTERRUPT_ENTRY(113)
|
||||
DISTINCT_INTERRUPT_ENTRY(114)
|
||||
DISTINCT_INTERRUPT_ENTRY(115)
|
||||
DISTINCT_INTERRUPT_ENTRY(116)
|
||||
DISTINCT_INTERRUPT_ENTRY(117)
|
||||
DISTINCT_INTERRUPT_ENTRY(118)
|
||||
DISTINCT_INTERRUPT_ENTRY(119)
|
||||
DISTINCT_INTERRUPT_ENTRY(120)
|
||||
DISTINCT_INTERRUPT_ENTRY(121)
|
||||
DISTINCT_INTERRUPT_ENTRY(122)
|
||||
DISTINCT_INTERRUPT_ENTRY(123)
|
||||
DISTINCT_INTERRUPT_ENTRY(124)
|
||||
DISTINCT_INTERRUPT_ENTRY(125)
|
||||
DISTINCT_INTERRUPT_ENTRY(126)
|
||||
DISTINCT_INTERRUPT_ENTRY(127)
|
||||
DISTINCT_INTERRUPT_ENTRY(128)
|
||||
DISTINCT_INTERRUPT_ENTRY(129)
|
||||
DISTINCT_INTERRUPT_ENTRY(130)
|
||||
DISTINCT_INTERRUPT_ENTRY(131)
|
||||
DISTINCT_INTERRUPT_ENTRY(132)
|
||||
DISTINCT_INTERRUPT_ENTRY(133)
|
||||
DISTINCT_INTERRUPT_ENTRY(134)
|
||||
DISTINCT_INTERRUPT_ENTRY(135)
|
||||
DISTINCT_INTERRUPT_ENTRY(136)
|
||||
DISTINCT_INTERRUPT_ENTRY(137)
|
||||
DISTINCT_INTERRUPT_ENTRY(138)
|
||||
DISTINCT_INTERRUPT_ENTRY(139)
|
||||
DISTINCT_INTERRUPT_ENTRY(140)
|
||||
DISTINCT_INTERRUPT_ENTRY(141)
|
||||
DISTINCT_INTERRUPT_ENTRY(142)
|
||||
DISTINCT_INTERRUPT_ENTRY(143)
|
||||
DISTINCT_INTERRUPT_ENTRY(144)
|
||||
DISTINCT_INTERRUPT_ENTRY(145)
|
||||
DISTINCT_INTERRUPT_ENTRY(146)
|
||||
DISTINCT_INTERRUPT_ENTRY(147)
|
||||
DISTINCT_INTERRUPT_ENTRY(148)
|
||||
DISTINCT_INTERRUPT_ENTRY(149)
|
||||
DISTINCT_INTERRUPT_ENTRY(150)
|
||||
DISTINCT_INTERRUPT_ENTRY(151)
|
||||
DISTINCT_INTERRUPT_ENTRY(152)
|
||||
DISTINCT_INTERRUPT_ENTRY(153)
|
||||
DISTINCT_INTERRUPT_ENTRY(154)
|
||||
DISTINCT_INTERRUPT_ENTRY(155)
|
||||
DISTINCT_INTERRUPT_ENTRY(156)
|
||||
DISTINCT_INTERRUPT_ENTRY(157)
|
||||
DISTINCT_INTERRUPT_ENTRY(158)
|
||||
DISTINCT_INTERRUPT_ENTRY(159)
|
||||
DISTINCT_INTERRUPT_ENTRY(160)
|
||||
DISTINCT_INTERRUPT_ENTRY(161)
|
||||
DISTINCT_INTERRUPT_ENTRY(162)
|
||||
DISTINCT_INTERRUPT_ENTRY(163)
|
||||
DISTINCT_INTERRUPT_ENTRY(164)
|
||||
DISTINCT_INTERRUPT_ENTRY(165)
|
||||
DISTINCT_INTERRUPT_ENTRY(166)
|
||||
DISTINCT_INTERRUPT_ENTRY(167)
|
||||
DISTINCT_INTERRUPT_ENTRY(168)
|
||||
DISTINCT_INTERRUPT_ENTRY(169)
|
||||
DISTINCT_INTERRUPT_ENTRY(170)
|
||||
DISTINCT_INTERRUPT_ENTRY(171)
|
||||
DISTINCT_INTERRUPT_ENTRY(172)
|
||||
DISTINCT_INTERRUPT_ENTRY(173)
|
||||
DISTINCT_INTERRUPT_ENTRY(174)
|
||||
DISTINCT_INTERRUPT_ENTRY(175)
|
||||
DISTINCT_INTERRUPT_ENTRY(176)
|
||||
DISTINCT_INTERRUPT_ENTRY(177)
|
||||
DISTINCT_INTERRUPT_ENTRY(178)
|
||||
DISTINCT_INTERRUPT_ENTRY(179)
|
||||
DISTINCT_INTERRUPT_ENTRY(180)
|
||||
DISTINCT_INTERRUPT_ENTRY(181)
|
||||
DISTINCT_INTERRUPT_ENTRY(182)
|
||||
DISTINCT_INTERRUPT_ENTRY(183)
|
||||
DISTINCT_INTERRUPT_ENTRY(184)
|
||||
DISTINCT_INTERRUPT_ENTRY(185)
|
||||
DISTINCT_INTERRUPT_ENTRY(186)
|
||||
DISTINCT_INTERRUPT_ENTRY(187)
|
||||
DISTINCT_INTERRUPT_ENTRY(188)
|
||||
DISTINCT_INTERRUPT_ENTRY(189)
|
||||
DISTINCT_INTERRUPT_ENTRY(190)
|
||||
DISTINCT_INTERRUPT_ENTRY(191)
|
||||
DISTINCT_INTERRUPT_ENTRY(192)
|
||||
DISTINCT_INTERRUPT_ENTRY(193)
|
||||
DISTINCT_INTERRUPT_ENTRY(194)
|
||||
DISTINCT_INTERRUPT_ENTRY(195)
|
||||
DISTINCT_INTERRUPT_ENTRY(196)
|
||||
DISTINCT_INTERRUPT_ENTRY(197)
|
||||
DISTINCT_INTERRUPT_ENTRY(198)
|
||||
DISTINCT_INTERRUPT_ENTRY(199)
|
||||
DISTINCT_INTERRUPT_ENTRY(200)
|
||||
DISTINCT_INTERRUPT_ENTRY(201)
|
||||
DISTINCT_INTERRUPT_ENTRY(202)
|
||||
DISTINCT_INTERRUPT_ENTRY(203)
|
||||
DISTINCT_INTERRUPT_ENTRY(204)
|
||||
DISTINCT_INTERRUPT_ENTRY(205)
|
||||
DISTINCT_INTERRUPT_ENTRY(206)
|
||||
DISTINCT_INTERRUPT_ENTRY(207)
|
||||
DISTINCT_INTERRUPT_ENTRY(208)
|
||||
DISTINCT_INTERRUPT_ENTRY(209)
|
||||
DISTINCT_INTERRUPT_ENTRY(210)
|
||||
DISTINCT_INTERRUPT_ENTRY(211)
|
||||
DISTINCT_INTERRUPT_ENTRY(212)
|
||||
DISTINCT_INTERRUPT_ENTRY(213)
|
||||
DISTINCT_INTERRUPT_ENTRY(214)
|
||||
DISTINCT_INTERRUPT_ENTRY(215)
|
||||
DISTINCT_INTERRUPT_ENTRY(216)
|
||||
DISTINCT_INTERRUPT_ENTRY(217)
|
||||
DISTINCT_INTERRUPT_ENTRY(218)
|
||||
DISTINCT_INTERRUPT_ENTRY(219)
|
||||
DISTINCT_INTERRUPT_ENTRY(220)
|
||||
DISTINCT_INTERRUPT_ENTRY(221)
|
||||
DISTINCT_INTERRUPT_ENTRY(222)
|
||||
DISTINCT_INTERRUPT_ENTRY(223)
|
||||
DISTINCT_INTERRUPT_ENTRY(224)
|
||||
DISTINCT_INTERRUPT_ENTRY(225)
|
||||
DISTINCT_INTERRUPT_ENTRY(226)
|
||||
DISTINCT_INTERRUPT_ENTRY(227)
|
||||
DISTINCT_INTERRUPT_ENTRY(228)
|
||||
DISTINCT_INTERRUPT_ENTRY(229)
|
||||
DISTINCT_INTERRUPT_ENTRY(230)
|
||||
DISTINCT_INTERRUPT_ENTRY(231)
|
||||
DISTINCT_INTERRUPT_ENTRY(232)
|
||||
DISTINCT_INTERRUPT_ENTRY(233)
|
||||
DISTINCT_INTERRUPT_ENTRY(234)
|
||||
DISTINCT_INTERRUPT_ENTRY(235)
|
||||
DISTINCT_INTERRUPT_ENTRY(236)
|
||||
DISTINCT_INTERRUPT_ENTRY(237)
|
||||
DISTINCT_INTERRUPT_ENTRY(238)
|
||||
DISTINCT_INTERRUPT_ENTRY(239)
|
||||
DISTINCT_INTERRUPT_ENTRY(240)
|
||||
DISTINCT_INTERRUPT_ENTRY(241)
|
||||
DISTINCT_INTERRUPT_ENTRY(242)
|
||||
DISTINCT_INTERRUPT_ENTRY(243)
|
||||
DISTINCT_INTERRUPT_ENTRY(244)
|
||||
DISTINCT_INTERRUPT_ENTRY(245)
|
||||
DISTINCT_INTERRUPT_ENTRY(246)
|
||||
DISTINCT_INTERRUPT_ENTRY(247)
|
||||
DISTINCT_INTERRUPT_ENTRY(248)
|
||||
DISTINCT_INTERRUPT_ENTRY(249)
|
||||
DISTINCT_INTERRUPT_ENTRY(250)
|
||||
DISTINCT_INTERRUPT_ENTRY(251)
|
||||
DISTINCT_INTERRUPT_ENTRY(252)
|
||||
DISTINCT_INTERRUPT_ENTRY(253)
|
||||
DISTINCT_INTERRUPT_ENTRY(254)
|
||||
DISTINCT_INTERRUPT_ENTRY(255)
|
||||
|
||||
/*PAGE
|
||||
* void _ISR_Dispatch()
|
||||
*
|
||||
* Entry point from the outermost interrupt service routine exit.
|
||||
* The current stack is the supervisor mode stack.
|
||||
*/
|
||||
|
||||
PUBLIC (_ISR_Dispatch)
|
||||
SYM (_ISR_Dispatch):
|
||||
|
||||
call SYM (_Thread_Dispatch) # invoke Dispatcher
|
||||
|
||||
/*
|
||||
* BEGINNING OF DE-ESTABLISH SEGMENTS
|
||||
*
|
||||
* NOTE: Make sure there is code here if code is added to
|
||||
* load the segment registers.
|
||||
*
|
||||
*/
|
||||
|
||||
/***** DE-ESTABLISH SEGMENTS CODE GOES HERE ****/
|
||||
|
||||
/*
|
||||
* END OF DE-ESTABLISH SEGMENTS
|
||||
*/
|
||||
|
||||
popa # restore general registers
|
||||
iret # return to interrupted thread
|
||||
|
||||
/*
|
||||
* GO32 does not require these segment related routines.
|
||||
*/
|
||||
|
||||
@@ -129,67 +129,6 @@ static inline unsigned int i386_swap_U16(
|
||||
return (sout);
|
||||
}
|
||||
|
||||
/*
|
||||
* IO Port Access Routines
|
||||
*/
|
||||
|
||||
#define i386_outport_byte( _port, _value ) \
|
||||
{ register unsigned short __port = _port; \
|
||||
register unsigned char __value = _value; \
|
||||
\
|
||||
asm volatile ( "outb %0,%1" : "=a" (__value), "=d" (__port) \
|
||||
: "0" (__value), "1" (__port) \
|
||||
); \
|
||||
}
|
||||
|
||||
#define i386_outport_word( _port, _value ) \
|
||||
{ register unsigned short __port = _port; \
|
||||
register unsigned short __value = _value; \
|
||||
\
|
||||
asm volatile ( "outw %0,%1" : "=a" (__value), "=d" (__port) \
|
||||
: "0" (__value), "1" (__port) \
|
||||
); \
|
||||
}
|
||||
|
||||
#define i386_outport_long( _port, _value ) \
|
||||
{ register unsigned short __port = _port; \
|
||||
register unsigned int __value = _value; \
|
||||
\
|
||||
asm volatile ( "outl %0,%1" : "=a" (__value), "=d" (__port) \
|
||||
: "0" (__value), "1" (__port) \
|
||||
); \
|
||||
}
|
||||
|
||||
#define i386_inport_byte( _port, _value ) \
|
||||
{ register unsigned short __port = _port; \
|
||||
register unsigned char __value = 0; \
|
||||
\
|
||||
asm volatile ( "inb %1,%0" : "=a" (__value), "=d" (__port) \
|
||||
: "0" (__value), "1" (__port) \
|
||||
); \
|
||||
_value = __value; \
|
||||
}
|
||||
|
||||
#define i386_inport_word( _port, _value ) \
|
||||
{ register unsigned short __port = _port; \
|
||||
register unsigned short __value = 0; \
|
||||
\
|
||||
asm volatile ( "inw %1,%0" : "=a" (__value), "=d" (__port) \
|
||||
: "0" (__value), "1" (__port) \
|
||||
); \
|
||||
_value = __value; \
|
||||
}
|
||||
|
||||
#define i386_inport_long( _port, _value ) \
|
||||
{ register unsigned short __port = _port; \
|
||||
register unsigned int __value = 0; \
|
||||
\
|
||||
asm volatile ( "inl %1,%0" : "=a" (__value), "=d" (__port) \
|
||||
: "0" (__value), "1" (__port) \
|
||||
); \
|
||||
_value = __value; \
|
||||
}
|
||||
|
||||
|
||||
/* routines */
|
||||
|
||||
|
||||
@@ -21,19 +21,16 @@
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <irq.h>
|
||||
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CLOCK_VECTOR 0x20
|
||||
|
||||
rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
|
||||
|
||||
volatile rtems_unsigned32 Clock_driver_ticks;
|
||||
|
||||
rtems_isr_entry Old_ticker;
|
||||
|
||||
void Clock_exit( void );
|
||||
|
||||
/*
|
||||
@@ -47,9 +44,7 @@ rtems_device_major_number rtems_clock_minor = 0;
|
||||
* This is the ISR handler.
|
||||
*/
|
||||
|
||||
rtems_isr Clock_isr(
|
||||
rtems_vector_number vector
|
||||
)
|
||||
void Clock_isr()
|
||||
{
|
||||
/* enable_tracing(); */
|
||||
Clock_driver_ticks += 1;
|
||||
@@ -61,16 +56,13 @@ rtems_isr Clock_isr(
|
||||
Clock_isrs -= 1;
|
||||
}
|
||||
|
||||
void Install_clock(
|
||||
rtems_isr_entry clock_isr
|
||||
)
|
||||
void ClockOff(const rtems_irq_connect_data* unused)
|
||||
{
|
||||
Clock_driver_ticks = 0;
|
||||
Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
|
||||
|
||||
if ( BSP_Configuration.ticks_per_timeslice ) {
|
||||
Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, CLOCK_VECTOR, 1 );
|
||||
/* should do something here */;
|
||||
}
|
||||
|
||||
void ClockOn(const rtems_irq_connect_data* unused)
|
||||
{
|
||||
/* The following is already set up in interns.s ->
|
||||
( This is test code only... production code will move the
|
||||
TMRCFG stuff here )
|
||||
@@ -81,24 +73,25 @@ void Install_clock(
|
||||
#define TMRCON 0xF043
|
||||
#define TMRCFG 0xF834
|
||||
|
||||
outport_byte ( TMRCFG , 0x80 );
|
||||
outport_byte ( TMRCFG , 0x80 );
|
||||
|
||||
outport_byte ( TMRCON , 0x34 );
|
||||
outport_byte ( TMR0 , 0xA8 );
|
||||
outport_byte ( TMR0 , 0x04 );
|
||||
outport_byte ( TMRCON , 0x34 );
|
||||
outport_byte ( TMR0 , 0xA8 );
|
||||
outport_byte ( TMR0 , 0x04 );
|
||||
|
||||
outport_byte ( TMRCFG , 0x00 );
|
||||
}
|
||||
atexit( Clock_exit );
|
||||
outport_byte ( TMRCFG , 0x00 );
|
||||
}
|
||||
|
||||
void Clock_exit( void )
|
||||
int ClockIsOn(const rtems_irq_connect_data* unused)
|
||||
{
|
||||
if ( BSP_Configuration.ticks_per_timeslice ) {
|
||||
/* should do something here */;
|
||||
}
|
||||
return ((i8259s_cache & 0x1) == 0);
|
||||
}
|
||||
|
||||
static rtems_irq_connect_data clockIrqData = {PC_386_PERIODIC_TIMER,
|
||||
Clock_isr,
|
||||
ClockOn,
|
||||
ClockOff,
|
||||
ClockIsOn};
|
||||
|
||||
rtems_device_driver Clock_initialize(
|
||||
rtems_device_major_number major,
|
||||
@@ -106,8 +99,12 @@ rtems_device_driver Clock_initialize(
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
Install_clock( Clock_isr );
|
||||
|
||||
Clock_driver_ticks = 0;
|
||||
Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
|
||||
if (!pc386_install_rtems_irq_handler (&clockIrqData)) {
|
||||
printk("Unable to initialize system clock\n");
|
||||
rtems_fatal_error_occurred(1);
|
||||
}
|
||||
/*
|
||||
* make major/minor avail to others such as shared memory driver
|
||||
*/
|
||||
@@ -124,7 +121,6 @@ rtems_device_driver Clock_control(
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
rtems_unsigned32 isrlevel;
|
||||
rtems_libio_ioctl_args_t *args = pargp;
|
||||
|
||||
if (args == 0)
|
||||
@@ -137,16 +133,21 @@ rtems_device_driver Clock_control(
|
||||
|
||||
if (args->command == rtems_build_name('I', 'S', 'R', ' '))
|
||||
{
|
||||
Clock_isr(CLOCK_VECTOR);
|
||||
Clock_isr();
|
||||
}
|
||||
else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
|
||||
{
|
||||
rtems_interrupt_disable( isrlevel );
|
||||
(void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
|
||||
rtems_interrupt_enable( isrlevel );
|
||||
if (!pc386_install_rtems_irq_handler (&clockIrqData)) {
|
||||
printk("Error installing clock interrupt handler!\n");
|
||||
rtems_fatal_error_occurred(1);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
void Clock_exit()
|
||||
{
|
||||
pc386_remove_rtems_irq_handler (&clockIrqData);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@ PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/console.rel
|
||||
|
||||
IMPORT_SRC=$(srcdir)/../../shared/io/printk.c
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=console
|
||||
C_PIECES=console printk
|
||||
C_FILES=$(C_PIECES:%=%.c)
|
||||
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
@@ -49,10 +51,13 @@ LDFLAGS +=
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
preinstall:
|
||||
${CP} ${IMPORT_SRC} .
|
||||
|
||||
${PGM}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
all: ${ARCH} preinstall $(SRCS) $(PGM)
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
|
||||
install: all
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include <bsp.h>
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#include <bspIo.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../start/80386ex.h"
|
||||
@@ -109,6 +109,18 @@ rtems_boolean is_character_ready(
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait for an input. May be used before intr are ON.
|
||||
*/
|
||||
char BSP_wait_polled_input( void )
|
||||
{
|
||||
char c;
|
||||
while (!is_character_ready(&c))
|
||||
continue;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/* inbyte
|
||||
*
|
||||
* This routine reads a character from the UART.
|
||||
@@ -277,3 +289,8 @@ rtems_device_driver console_control(
|
||||
{
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
BSP_output_char_function_type BSP_output_char = outbyte;
|
||||
BSP_polling_getchar_function_type BSP_poll_char = BSP_wait_polled_input;
|
||||
|
||||
void BSP_emergency_output_init() {}
|
||||
|
||||
@@ -23,7 +23,9 @@ extern "C" {
|
||||
#include <iosupp.h>
|
||||
#include <console.h>
|
||||
#include <clockdrv.h>
|
||||
|
||||
#include <bspIo.h>
|
||||
#include <irq.h>
|
||||
|
||||
/*
|
||||
* Define the time limits for RTEMS Test Suite test durations.
|
||||
* Long test and short test duration limits are provided. These
|
||||
@@ -129,12 +131,6 @@ BSP_EXTERN unsigned int Gdt_base;
|
||||
|
||||
/* routines */
|
||||
|
||||
i386_isr_entry set_vector(
|
||||
rtems_isr_entry handler,
|
||||
rtems_vector_number vector,
|
||||
int type
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
#include "macros.inc"
|
||||
#include "80386ex.inc"
|
||||
|
||||
/*
|
||||
* Needed for binutils 2.9.1.0.7 and higher
|
||||
* #define NEXT_GAS
|
||||
*/
|
||||
|
||||
EXTERN (main) /* exits to bspstart */
|
||||
EXTERN (stack_start) /* defined in startup/linkcmds */
|
||||
@@ -179,6 +183,9 @@ SYM(reset):
|
||||
.code16
|
||||
nop
|
||||
cli
|
||||
#ifdef NEXT_GAS
|
||||
addr32
|
||||
#endif
|
||||
jmp SYM(_initInternalRegisters) /* different section in this file */
|
||||
.code32 /* in case this section moves */
|
||||
nop /* required by CHIP LAB to pad out size */
|
||||
@@ -192,8 +199,8 @@ SYM(reset):
|
||||
/*
|
||||
* Enable access to peripheral register at expanded I/O addresses
|
||||
*/
|
||||
.code16
|
||||
SYM(_initInternalRegisters):
|
||||
.code16
|
||||
movw $0x8000 , ax
|
||||
outb al , $REMAPCFGH
|
||||
xchg al , ah
|
||||
@@ -406,8 +413,8 @@ SYM(InitInt):
|
||||
|
||||
SetExRegByte(ICW1M , 0x11 ) # edge triggered
|
||||
SetExRegByte(ICW2M , 0x20 ) # base vector starts at byte 32
|
||||
SetExRegByte(ICW3M , 0x04 ) # IR2 is cascaded internally
|
||||
SetExRegByte(ICW4M , 0X03 ) # AEOI MODE FIRST!
|
||||
SetExRegByte(ICW3M , 0x02 ) # IR2 is cascaded internally
|
||||
SetExRegByte(ICW4M , 0x01 ) # idem
|
||||
|
||||
SetExRegByte(OCW1M , 0xde ) # IR0 only = 0xfe. for IR5 and IR0 active use 0xde
|
||||
SetExRegByte(INTCFG , 0x00 )
|
||||
@@ -481,7 +488,10 @@ SYM(xfer_gdt):
|
||||
|
||||
movw $ _ram_gdt_segment, ax
|
||||
mov ax , ds
|
||||
|
||||
#ifdef NEXT_GAS
|
||||
data32
|
||||
addr32
|
||||
#endif
|
||||
lgdt _ram_gdt_offset # location of GDT
|
||||
|
||||
|
||||
@@ -494,16 +504,16 @@ SYM(SetUCS):
|
||||
/***************************
|
||||
* Switch to Protected Mode
|
||||
***************************/
|
||||
mov %cr0, eax
|
||||
mov cr0, eax
|
||||
orw $0x1, ax
|
||||
mov eax, %cr0
|
||||
mov eax, cr0
|
||||
|
||||
/**************************
|
||||
* Flush prefetch queue,
|
||||
* and load CS selector
|
||||
*********************/
|
||||
|
||||
ljmp $ GDT_CODE_PTR , $ SYM(_copy_data) # sets the code selector
|
||||
ljmpl $ GDT_CODE_PTR , $ SYM(_copy_data) # sets the code selector
|
||||
/*
|
||||
* Copy the data section down to RAM
|
||||
*/
|
||||
|
||||
@@ -10,8 +10,11 @@ PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/startup.rel
|
||||
|
||||
IMPORT_SRC=$(srcdir)/../../shared/irq/irq.c \
|
||||
$(srcdir)/../../shared/irq/irq_init.c $(srcdir)/../../shared/irq/irq_asm.s
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec
|
||||
C_PIECES=bspclean bsplibc bsppost bspstart main sbrk irq irq_init
|
||||
C_FILES=$(C_PIECES:%=%.c)
|
||||
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
@@ -19,7 +22,7 @@ H_FILES=
|
||||
|
||||
# Assembly source names, if any, go here -- minus the .s
|
||||
# removed initcsu piece, ldsegs piece and flush
|
||||
S_PIECES=
|
||||
S_PIECES=irq_asm
|
||||
S_FILES=$(S_PIECES:%=%.s)
|
||||
S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)
|
||||
|
||||
@@ -52,9 +55,12 @@ LDFLAGS +=
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
preinstall:
|
||||
${CP} ${IMPORT_SRC} .
|
||||
|
||||
${PGM}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
all: ${ARCH} preinstall $(SRCS) $(PGM)
|
||||
$(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
|
||||
|
||||
@@ -114,5 +114,8 @@ void bsp_start( void )
|
||||
*/
|
||||
|
||||
/* console_reserve_resources( &BSP_Configuration ); */
|
||||
|
||||
/*
|
||||
* Init rtems_interrupt_management
|
||||
*/
|
||||
rtems_irq_mngt_init();
|
||||
}
|
||||
|
||||
@@ -27,11 +27,13 @@
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int Ttimer_val;
|
||||
rtems_boolean Timer_driver_Find_average_overhead;
|
||||
|
||||
rtems_isr timerisr();
|
||||
extern void timerisr();
|
||||
extern int ClockIsOn(const rtems_raw_irq_connect_data*);
|
||||
|
||||
#define TMR0 0xF040
|
||||
#define TMR1 0xF041
|
||||
@@ -39,11 +41,9 @@ rtems_isr timerisr();
|
||||
#define TMRCON 0xF043
|
||||
#define TMRCFG 0xF834
|
||||
|
||||
void Timer_initialize()
|
||||
void TimerOn(const rtems_raw_irq_connect_data* used)
|
||||
{
|
||||
|
||||
(void) set_vector( timerisr, 0x2a, 0 ); /* install ISR ( IR2 ) was 0x38*/
|
||||
|
||||
Ttimer_val = 0; /* clear timer ISR count */
|
||||
|
||||
outport_byte ( TMRCON , 0xb0 ); /* select tmr2, stay in mode 0 */
|
||||
@@ -51,8 +51,58 @@ void Timer_initialize()
|
||||
outport_byte ( TMR1 , 0x00 );
|
||||
outport_byte ( TMRCON , 0x64 ); /* change to mode 2 ( starts timer ) */
|
||||
/* interrupts ARE enabled */
|
||||
/* outport_byte( IERA, 0x41 ); enable interrupt */
|
||||
/* outport_byte( IERA, 0x41 ); enable interrupt */
|
||||
/*
|
||||
* enable interrrupt at i8259 level
|
||||
*/
|
||||
pc386_irq_enable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE);
|
||||
}
|
||||
|
||||
void TimerOff(const rtems_raw_irq_connect_data* used)
|
||||
{
|
||||
/*
|
||||
* disable interrrupt at i8259 level
|
||||
*/
|
||||
pc386_irq_disable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE);
|
||||
/* reset timer mode to standard (DOS) value */
|
||||
}
|
||||
|
||||
static rtems_raw_irq_connect_data timer_raw_irq_data = {
|
||||
PC_386_RT_TIMER3 + PC386_IRQ_VECTOR_BASE,
|
||||
timerisr,
|
||||
TimerOn,
|
||||
TimerOff,
|
||||
ClockIsOn
|
||||
};
|
||||
|
||||
void Timer_exit()
|
||||
{
|
||||
if (!i386_delete_idt_entry(&timer_raw_irq_data)) {
|
||||
printk("Timer raw handler deconnexion failed\n");
|
||||
rtems_fatal_error_occurred(1);
|
||||
}
|
||||
}
|
||||
|
||||
void Timer_initialize()
|
||||
{
|
||||
|
||||
static rtems_boolean First = TRUE;
|
||||
|
||||
if (First)
|
||||
{
|
||||
First = FALSE;
|
||||
|
||||
atexit(Timer_exit); /* Try not to hose the system at exit. */
|
||||
if (!i386_set_idt_entry (&timer_raw_irq_data)) {
|
||||
printk("raw handler connexion failed\n");
|
||||
rtems_fatal_error_occurred(1);
|
||||
}
|
||||
}
|
||||
/* wait for ISR to be called at least once */
|
||||
Ttimer_val = 0;
|
||||
while (Ttimer_val == 0)
|
||||
continue;
|
||||
Ttimer_val = 0;
|
||||
}
|
||||
|
||||
#define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
PUBLIC (timerisr)
|
||||
SYM (timerisr):
|
||||
addl $250, SYM (Ttimer_val) # another 250 microseconds
|
||||
pushl eax
|
||||
movb 0xa0,al /* signal generic End Of Interrupt (EOI) to slave PIC */
|
||||
outb al, $0x20
|
||||
movb $0x20, al
|
||||
outb al, $0x20 /* signal generic EOI to Master PIC */
|
||||
popl eax
|
||||
iret
|
||||
|
||||
END_CODE
|
||||
|
||||
@@ -10,6 +10,8 @@ PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/console.rel
|
||||
|
||||
IMPORT_SRC=$(srcdir)/../../shared/io/printk.c
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=console inch outch printk
|
||||
C_FILES=$(C_PIECES:%=%.c)
|
||||
@@ -50,10 +52,13 @@ LDFLAGS +=
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
preinstall:
|
||||
${CP} ${IMPORT_SRC} .
|
||||
|
||||
${PGM}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
all: ${ARCH} preinstall $(SRCS) $(PGM)
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
|
||||
install: all
|
||||
|
||||
@@ -61,6 +61,8 @@ static rtems_irq_connect_data console_isr_data = {PC_386_KEYBOARD,
|
||||
|
||||
|
||||
extern rtems_boolean _IBMPC_scankey(char *); /* defined in 'inch.c' */
|
||||
extern BSP_polling_getchar_function_type BSP_wait_polled_input();
|
||||
extern void _IBMPC_initVideo();
|
||||
|
||||
void console_reserve_resources(rtems_configuration_table *conf)
|
||||
{
|
||||
@@ -475,6 +477,16 @@ conSetAttr(int minor, const struct termios *t)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* BSP initialization
|
||||
*/
|
||||
|
||||
BSP_output_char_function_type BSP_output_char = (BSP_output_char_function_type) _IBMPC_outch;
|
||||
BSP_polling_getchar_function_type BSP_poll_char = BSP_wait_polled_input;
|
||||
void BSP_emergency_output_init()
|
||||
{
|
||||
_IBMPC_initVideo();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ _IBMPC_inch(void)
|
||||
*/
|
||||
|
||||
char
|
||||
debugPollingGetChar(void)
|
||||
BSP_wait_polled_input(void)
|
||||
{
|
||||
char c;
|
||||
while (!_IBMPC_scankey(&c))
|
||||
|
||||
@@ -52,6 +52,7 @@ extern "C" {
|
||||
#include <console.h>
|
||||
#include <clockdrv.h>
|
||||
#include <libcpu/cpu.h>
|
||||
#include <bspIo.h>
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Constants
|
||||
|
||||
@@ -58,7 +58,7 @@ preinstall:
|
||||
|
||||
${PGM}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
all: ${ARCH} preinstall $(SRCS) $(PGM)
|
||||
$(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib
|
||||
|
||||
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
|
||||
|
||||
@@ -176,7 +176,7 @@ void timerOn(const rtems_raw_irq_connect_data* used)
|
||||
outport_byte(TIMER_CNTR0, US_TO_TICK(US_PER_ISR) >> 0 & 0xff);
|
||||
outport_byte(TIMER_CNTR0, US_TO_TICK(US_PER_ISR) >> 8 & 0xff);
|
||||
/*
|
||||
* disable interrrupt at i8259 level
|
||||
* enable interrrupt at i8259 level
|
||||
*/
|
||||
pc386_irq_enable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE);
|
||||
}
|
||||
|
||||
@@ -12,5 +12,5 @@ include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/directory.cfg
|
||||
|
||||
# Descend into the $(RTEMS_BSP_FAMILY) directory
|
||||
SUB_DIRS=irq
|
||||
SUB_DIRS=irq io
|
||||
|
||||
|
||||
33
c/src/lib/libbsp/i386/shared/io/Makefile.in
Normal file
33
c/src/lib/libbsp/i386/shared/io/Makefile.in
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
H_FILES = $(srcdir)/bspIo.h
|
||||
|
||||
#
|
||||
# Equate files are for including from assembly preprocessed by
|
||||
# gm4 or gasp. No examples are provided except for those for
|
||||
# other CPUs. The best way to generate them would be to
|
||||
# provide a program which generates the constants used based
|
||||
# on the C equivalents.
|
||||
#
|
||||
|
||||
EQ_FILES =
|
||||
|
||||
SRCS=$(H_FILES) $(EQ_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
preinstall all: $(SRCS)
|
||||
$(INSTALL) -m 444 $(H_FILES) $(PROJECT_INCLUDE)
|
||||
$(INSTALL) -m 444 $(EQ_FILES) $(PROJECT_INCLUDE)
|
||||
38
c/src/lib/libbsp/i386/shared/io/bspIo.h
Normal file
38
c/src/lib/libbsp/i386/shared/io/bspIo.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* bspIo.h
|
||||
*
|
||||
* This include file contains declaration of interface that
|
||||
* will be provided by the file contained in this directory.
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1998 valette@crf.canon.fr
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
#ifndef _LIBBSP_I386_SHARED_IO_BSP_IO_H
|
||||
#define _LIBBSP_I386_SHARED_IO_BSP_IO_H
|
||||
|
||||
/*
|
||||
* All the functions declared as extern after this comment
|
||||
* MUST be implemented in each BSP. Using this function,
|
||||
* this directory contains shared code that export higher level
|
||||
* functionnality described after the next command.
|
||||
*/
|
||||
typedef void (*BSP_output_char_function_type) (char c);
|
||||
typedef char (*BSP_polling_getchar_function_type) (char c);
|
||||
|
||||
extern BSP_output_char_function_type BSP_output_char;
|
||||
extern BSP_polling_getchar_function_type BSP_poll_char;
|
||||
extern void BSP_emergency_output_init();
|
||||
/*
|
||||
* All the function declared as extern after this comment
|
||||
* are available for each ix86 BSP by compiling and linking
|
||||
* the files contained in this directory PROVIDED definition
|
||||
* and initialisation of the previous variable are done.
|
||||
*/
|
||||
void printk(char *fmt, ...);
|
||||
|
||||
#endif
|
||||
99
c/src/lib/libbsp/i386/shared/io/printk.c
Normal file
99
c/src/lib/libbsp/i386/shared/io/printk.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*-------------------------------------------------------------------------+
|
||||
| printk.c v1.1 - PC386 BSP - 1997/08/07
|
||||
+--------------------------------------------------------------------------+
|
||||
| (C) Copyright 1997 -
|
||||
| - NavIST Group - Real-Time Distributed Systems and Industrial Automation
|
||||
|
|
||||
| http://pandora.ist.utl.pt
|
||||
|
|
||||
| Instituto Superior Tecnico * Lisboa * PORTUGAL
|
||||
+--------------------------------------------------------------------------+
|
||||
| Disclaimer:
|
||||
|
|
||||
| This file is provided "AS IS" without warranty of any kind, either
|
||||
| expressed or implied.
|
||||
+--------------------------------------------------------------------------+
|
||||
| This code is based on code by: Jose Rufino - IST
|
||||
|
|
||||
| $Id$
|
||||
+--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <bspIo.h>
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Function: printNum
|
||||
| Description: print number in a given base.
|
||||
| Global Variables: None.
|
||||
| Arguments: num - number to print, base - base used to print the number.
|
||||
| Returns: Nothing.
|
||||
+--------------------------------------------------------------------------*/
|
||||
static void
|
||||
printNum(long int num, int base)
|
||||
{
|
||||
long int n;
|
||||
|
||||
if ((n = num / base) > 0)
|
||||
printNum(n, base);
|
||||
BSP_output_char("0123456789ABCDEF"[(int)(num % base)]);
|
||||
} /* printNum */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| Function: printk
|
||||
| Description: a simplified version of printf intended for use when the
|
||||
console is not yet initialized or in ISR's.
|
||||
| Global Variables: None.
|
||||
| Arguments: as in printf: fmt - format string, ... - unnamed arguments.
|
||||
| Returns: Nothing.
|
||||
+--------------------------------------------------------------------------*/
|
||||
void
|
||||
printk(char *fmt, ...)
|
||||
{
|
||||
va_list ap; /* points to each unnamed argument in turn */
|
||||
char c, *str;
|
||||
int lflag, base;
|
||||
|
||||
va_start(ap, fmt); /* make ap point to 1st unnamed arg */
|
||||
for (; *fmt != '\0'; fmt++)
|
||||
{
|
||||
lflag = 0;
|
||||
base = 0;
|
||||
if (*fmt == '%')
|
||||
{
|
||||
if ((c = *++fmt) == 'l')
|
||||
{
|
||||
lflag = 1;
|
||||
c = *++fmt;
|
||||
}
|
||||
switch (c)
|
||||
{
|
||||
case 'o': case 'O': base = 8; break;
|
||||
case 'd': case 'D': base = 10; break;
|
||||
case 'x': case 'X': base = 16; break;
|
||||
case 's':
|
||||
for (str = va_arg(ap, char *); *str; str++)
|
||||
BSP_output_char(*str);
|
||||
break;
|
||||
case 'c':
|
||||
BSP_output_char(va_arg(ap, char));
|
||||
break;
|
||||
default:
|
||||
BSP_output_char(c);
|
||||
break;
|
||||
} /* switch*/
|
||||
|
||||
if (base)
|
||||
printNum(lflag ? va_arg(ap, long int) : (long int)va_arg(ap, int),
|
||||
base);
|
||||
}
|
||||
else
|
||||
{
|
||||
BSP_output_char(*fmt);
|
||||
}
|
||||
}
|
||||
va_end(ap); /* clean up when done */
|
||||
} /* printk */
|
||||
|
||||
@@ -55,8 +55,9 @@ typedef enum {
|
||||
|
||||
PC386_UART_COM1_IRQ = 4,
|
||||
|
||||
PC_386_RT_TIMER1 = 8
|
||||
|
||||
PC_386_RT_TIMER1 = 8,
|
||||
|
||||
PC_386_RT_TIMER3 = 10
|
||||
}rtems_irq_symbolic_name;
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <libcpu/cpu.h>
|
||||
#include <irq.h>
|
||||
#include <bsp.h>
|
||||
#include <bspIo.h>
|
||||
|
||||
/*
|
||||
* rtems prologue generated in irq_asm.S
|
||||
@@ -137,7 +138,7 @@ void rtems_irq_mngt_init()
|
||||
/*
|
||||
* put something here that will show the failure...
|
||||
*/
|
||||
_IBMPC_initVideo();
|
||||
BSP_emergency_output_init();
|
||||
printk("Unable to initialize IDT!!! System locked\n");
|
||||
while (1);
|
||||
}
|
||||
@@ -172,7 +173,7 @@ void rtems_irq_mngt_init()
|
||||
/*
|
||||
* put something here that will show the failure...
|
||||
*/
|
||||
_IBMPC_initVideo();
|
||||
BSP_emergency_output_init();
|
||||
printk("Unable to initialize RTEMS interrupt Management!!! System locked\n");
|
||||
while (1);
|
||||
}
|
||||
@@ -187,7 +188,7 @@ void rtems_irq_mngt_init()
|
||||
*/
|
||||
unsigned tmp;
|
||||
|
||||
_IBMPC_initVideo();
|
||||
BSP_emergency_output_init();
|
||||
|
||||
printk("idt_entry_tbl = %x Interrupt_descriptor_table addr = %x\n",
|
||||
idt_entry_tbl, &Interrupt_descriptor_table);
|
||||
@@ -196,7 +197,7 @@ void rtems_irq_mngt_init()
|
||||
tmp, (unsigned) rtems_irq_prologue_0);
|
||||
}
|
||||
printk("i8259s_cache = %x\n", * (unsigned short*) &i8259s_cache);
|
||||
debugPollingGetChar();
|
||||
BSP_wait_polled_input();
|
||||
#endif
|
||||
asm volatile ("sti");
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ VPATH = @srcdir@
|
||||
RTEMS_ROOT = @top_srcdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
PGM=${ARCH}/libcpu.rel
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES=cpu displayCpu
|
||||
@@ -26,7 +25,9 @@ SRCS=$(C_FILES) $(H_FILES)
|
||||
OBJS=$(C_O_FILES) $(S_O_FILES)
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
include $(RTEMS_ROOT)/make/lib.cfg
|
||||
|
||||
LIB=${ARCH}/libcpuspec.a
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
@@ -50,14 +51,14 @@ LDFLAGS +=
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
${PGM}: ${SRCS} ${OBJS}
|
||||
$(make-rel)
|
||||
${LIB}: ${SRCS} ${OBJS}
|
||||
$(make-library)
|
||||
|
||||
preinstall :
|
||||
$(MKDIR) $(PROJECT_INCLUDE)/libcpu
|
||||
$(INSTALL) -m 444 ${H_FILES} $(PROJECT_INCLUDE)/libcpu
|
||||
|
||||
all: ${ARCH} $(SRCS) preinstall $(OBJ) $(PGM)
|
||||
all: ${ARCH} $(SRCS) preinstall $(OBJ) $(LIB)
|
||||
cd wrapup; $(MAKE)
|
||||
|
||||
# the .rel file built here will be put into libcpu.a by ../wrapup/Makefile
|
||||
|
||||
@@ -29,4 +29,4 @@ extern char x86_vendor_id[13];
|
||||
extern int have_cpuid;
|
||||
extern unsigned char Cx86_step; /* cyrix processor identification */
|
||||
|
||||
extern voidget_cpuinfo(); /* Display this information in ascii form */
|
||||
extern void printCpuInfo(); /* Display this information on console in ascii form */
|
||||
|
||||
@@ -173,7 +173,7 @@ static const char * getmodel(int x86, int model)
|
||||
|
||||
void printCpuInfo()
|
||||
{
|
||||
int i, len = 0;
|
||||
int i;
|
||||
static const char *x86_cap_flags[] = {
|
||||
"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
|
||||
"cx8", "apic", "10", "11", "mtrr", "pge", "mca", "cmov",
|
||||
|
||||
@@ -12,7 +12,7 @@ BSP_PIECES=startup clock console timer
|
||||
GENERIC_PIECES=
|
||||
|
||||
# bummer; have to use $foreach since % pattern subst rules only replace 1x
|
||||
OBJS=../$(ARCH)/libcpu.rel
|
||||
OBJS=../$(ARCH)/libcpuspec.a
|
||||
LIB=$(ARCH)/libcpu.a
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
@@ -41,7 +41,22 @@ CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
$(LIB): ${OBJS}
|
||||
$(make-library)
|
||||
@ list_of_o_files=""; \
|
||||
for i in ${OBJS}; \
|
||||
do \
|
||||
DIRNAME=`dirname ${OBJS}` ; \
|
||||
temp=`$(AR) t $$i`; \
|
||||
echo $$temp ;\
|
||||
echo $$DIRNAME ;\
|
||||
for j in $$temp; \
|
||||
do \
|
||||
list_of_o_files="$$list_of_o_files $$DIRNAME/$$j"; \
|
||||
done ;\
|
||||
echo $$list_of_o_files ;\
|
||||
done ;\
|
||||
$(RM) $@ ;\
|
||||
$(AR) $(ARFLAGS) $@ $$list_of_o_files ;\
|
||||
$(MKLIB) $@
|
||||
|
||||
all: ${ARCH} $(SRCS) $(LIB)
|
||||
$(INSTALL_VARIANT) -m 644 $(LIB) ${PROJECT_RELEASE}/lib
|
||||
|
||||
Reference in New Issue
Block a user