Patch from Aleksey (Quality Quorum <qqi@world.std.com>):

1. Finally fixes raw interrupts for pc386
    2. Makes some minor cleanup in console and startup
    3. Makes rtems_termios_dequeue_characters() to return count of
       outstanding chars - it allows to simplify console isrs a little
       bit.
    4. pc386 uart modified to be friendlier to termios parameter changes,
       to have minor performance improvement and to take advantage of
       of above termios modification.
This commit is contained in:
Joel Sherrill
1998-09-23 13:20:34 +00:00
parent 362b88ebb5
commit 8a496e462e
16 changed files with 90 additions and 88 deletions

View File

@@ -157,7 +157,7 @@ rtems_status_code rtems_termios_read (void *arg);
rtems_status_code rtems_termios_write (void *arg);
rtems_status_code rtems_termios_ioctl (void *arg);
int rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len);
void rtems_termios_dequeue_characters (void *ttyp, int len);
int rtems_termios_dequeue_characters (void *ttyp, int len);
void rtems_termios_reserve_resources(
rtems_configuration_table *configuration,
rtems_unsigned32 number_of_devices

View File

@@ -894,9 +894,10 @@ rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len)
* device transmit interrupt handler.
* The second argument is the number of characters transmitted so far.
* This value will always be 1 for devices which generate an interrupt
* for each transmitted character.
* for each transmitted character.
* It returns number of characters left to transmit
*/
void
int
rtems_termios_dequeue_characters (void *ttyp, int len)
{
struct rtems_termios_tty *tty = ttyp;
@@ -906,13 +907,14 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
if (tty->rawOutBufState == rob_wait)
rtems_semaphore_release (tty->rawOutBufSemaphore);
if ( tty->rawOutBufHead == tty->rawOutBufTail )
return;
return 0;
newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE;
if (newTail == tty->rawOutBufHead) {
/*
* Buffer empty
*/
tty->rawOutBufState = rob_idle;
nToSend = 0;
}
else {
/*
@@ -926,4 +928,8 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
tty->rawOutBufState = rob_busy;
}
tty->rawOutBufTail = newTail;
return nToSend;
}

View File

@@ -157,7 +157,7 @@ rtems_status_code rtems_termios_read (void *arg);
rtems_status_code rtems_termios_write (void *arg);
rtems_status_code rtems_termios_ioctl (void *arg);
int rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len);
void rtems_termios_dequeue_characters (void *ttyp, int len);
int rtems_termios_dequeue_characters (void *ttyp, int len);
void rtems_termios_reserve_resources(
rtems_configuration_table *configuration,
rtems_unsigned32 number_of_devices

View File

@@ -58,28 +58,46 @@
int PC386ConsolePort = PC386_CONSOLE_PORT_CONSOLE;
static int conSetAttr(int minor, const struct termios *);
extern BSP_polling_getchar_function_type BSP_poll_char;
/*-------------------------------------------------------------------------+
| External Prototypes
+--------------------------------------------------------------------------*/
extern void _IBMPC_keyboard_isr(void);
extern void _IBMPC_keyboard_isr_on(const rtems_irq_connect_data*);
extern void _IBMPC_keyboard_isr_off(const rtems_irq_connect_data*);
extern int _IBMPC_keyboard_isr_is_on(const rtems_irq_connect_data*);
static rtems_irq_connect_data console_isr_data = {PC_386_KEYBOARD,
_IBMPC_keyboard_isr,
_IBMPC_keyboard_isr_on,
_IBMPC_keyboard_isr_off,
_IBMPC_keyboard_isr_is_on};
extern void _IBMPC_keyboard_isr(void);
extern rtems_boolean _IBMPC_scankey(char *); /* defined in 'inch.c' */
extern char BSP_wait_polled_input(void);
extern void _IBMPC_initVideo(void);
static int conSetAttr(int minor, const struct termios *);
static void isr_on(const rtems_irq_connect_data *);
static void isr_off(const rtems_irq_connect_data *);
static int isr_is_on(const rtems_irq_connect_data *);
static rtems_irq_connect_data console_isr_data = {PC_386_KEYBOARD,
_IBMPC_keyboard_isr,
isr_on,
isr_off,
isr_is_on};
static void
isr_on(const rtems_irq_connect_data *unused)
{
return;
}
static void
isr_off(const rtems_irq_connect_data *unused)
{
return;
}
static int
isr_is_on(const rtems_irq_connect_data *irq)
{
return pc386_irq_enabled_at_i8259s(irq->name);
}
void console_reserve_resources(rtems_configuration_table *conf)
{
if(PC386ConsolePort != PC386_CONSOLE_PORT_CONSOLE)
@@ -203,7 +221,7 @@ console_initialize(rtems_device_major_number major,
{
printk("Initialized console on port COM2 9600-8-N-1\n\n");
}
#define PRINTK_ON_SERIAL
#define PRINTK_ON_SERIAL
#ifdef PRINTK_ON_SERIAL
/*
* You can remove the follwoing tree lines if you want to have printk
@@ -221,9 +239,11 @@ console_initialize(rtems_device_major_number major,
static int console_open_count = 0;
static void console_last_close()
static int console_last_close(int major, int minor, void *arg)
{
pc386_remove_rtems_irq_handler (&console_isr_data);
return 0;
}
/*-------------------------------------------------------------------------+
@@ -294,7 +314,7 @@ console_close(rtems_device_major_number major,
}
else {
if (--console_open_count == 0) {
console_last_close();
console_last_close(major, minor, arg);
}
}
@@ -474,9 +494,4 @@ BSP_output_char_function_type BSP_output_char =
BSP_polling_getchar_function_type BSP_poll_char = BSP_wait_polled_input;
void BSP_emergency_output_init()
{
_IBMPC_initVideo();
}

View File

@@ -210,18 +210,6 @@ _IBMPC_scankey(char *outChar)
return TRUE;
} /* _IBMPC_scankey */
void _IBMPC_keyboard_isr_on(const rtems_irq_connect_data* unused)
{}
void _IBMPC_keyboard_isr_off(const rtems_irq_connect_data* unused)
{}
int _IBMPC_keyboard_isr_is_on(const rtems_irq_connect_data* irq)
{
return pc386_irq_enabled_at_i8259s (irq->name);
}
/*-------------------------------------------------------------------------+
| Function: _IBMPC_keyboard_isr
| Description: Interrupt Service Routine for keyboard (0x01) IRQ.

View File

@@ -36,7 +36,6 @@
#include <libcsupport.h>
#include <rtems/libio.h>
#include <libcpu/cpuModel.h>
#include <pc386uart.h>
/*-------------------------------------------------------------------------+
| Global Variables
@@ -64,17 +63,12 @@ extern rtems_configuration_table Configuration;
rtems_cpu_table Cpu_table; /* CPU configuration table. */
char *rtems_progname; /* Program name - from main(). */
extern void debugPollingGetChar();
/*-------------------------------------------------------------------------+
| External Prototypes
+--------------------------------------------------------------------------*/
extern void _exit(int); /* define in exit.c */
extern void _IBMPC_initVideo(void);
extern void rtems_irq_mngt_init();
extern void rtems_irq_mngt_init(void);
void bsp_libc_init( void *, unsigned32, int );
void bsp_postdriver_hook(void);
extern void _IBMPC_initVideo(void);
/*-------------------------------------------------------------------------+
| Function: bsp_pretasking_hook
@@ -108,8 +102,6 @@ void bsp_pretasking_hook(void)
*(volatile rtems_unsigned32 *)topAddr = topAddr;
}
printk("\n");
for(i=2; i<=2048; i++)
{
topAddr = i*1024*1024 - 4;
@@ -145,14 +137,12 @@ void bsp_pretasking_hook(void)
| Returns: Nothing.
+--------------------------------------------------------------------------*/
void bsp_start( void )
/* Initialize printk channel */
_IBMPC_initVideo();
{
/*
* Calibrate variable for 1ms-loop (see timer.c)
*/
Calibrate_loop_1ms();
/*
* Initialize printk channel
*/

View File

@@ -37,7 +37,7 @@
#include <rtems/libio.h>
#include <pc386uart.h>
void bsp_cleanup()
void bsp_cleanup(void)
{
unsigned char ch;
static char line[]="EXECUTIVE SHUTDOWN! Any key to reboot...";
@@ -56,3 +56,6 @@ void bsp_cleanup()

View File

@@ -46,13 +46,6 @@ rtems_raw_irq_hdl get_hdl_from_vector(rtems_vector_offset index)
i386_get_info_from_IDTR (&idt_entry_tbl, &limit);
/* Convert limit into number of entries */
limit = (limit + 1) >> 3;
if(index >= limit) {
return 0;
}
/* Convert limit into number of entries */
limit = (limit + 1) / sizeof(interrupt_gate_descriptor);
@@ -279,7 +272,7 @@ int i386_set_gdt_entry (unsigned short segment_selector, unsigned base,
gdt_entry_tbl[segment_selector].present = 1; /* not present */
/*
return 1;
* Now, reload all segment registers so the limit takes effect.
*/
asm volatile( "movw %%ds,%0 ; movw %0,%%ds

View File

@@ -116,22 +116,30 @@ void rtems_irq_mngt_init()
{
int i;
interrupt_gate_descriptor* idt_entry_tbl;
unsigned limit;
unsigned int limit;
unsigned int level;
i386_get_info_from_IDTR (&idt_entry_tbl, &limit);
/* Convert limit into number of entries */
limit = (limit + 1) / sizeof(interrupt_gate_descriptor);
i386_get_info_from_IDTR(&idt_entry_tbl, &limit);
/* Convert into number of entries */
limit = (limit + 1)/sizeof(interrupt_gate_descriptor);
if(limit != IDT_SIZE) {
printk("IDT table size mismatch !!! System locked\n");
while(1);
}
_CPU_ISR_Disable(level);
/*
* Init the complete IDT vector table with defaultRawIrq value
*/
for (i = 0; i < limit; i++) {
for (i = 0; i < IDT_SIZE ; i++) {
idtHdl[i] = defaultRawIrq;
idtHdl[i].idtIndex = i;
}
raw_initial_config.idtSize = IDT_SIZE;
raw_initial_config.defaultRawEntry = defaultRawIrq;
raw_initial_config.rawIrqHdlTbl = idtHdl;

View File

@@ -157,7 +157,7 @@ rtems_status_code rtems_termios_read (void *arg);
rtems_status_code rtems_termios_write (void *arg);
rtems_status_code rtems_termios_ioctl (void *arg);
int rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len);
void rtems_termios_dequeue_characters (void *ttyp, int len);
int rtems_termios_dequeue_characters (void *ttyp, int len);
void rtems_termios_reserve_resources(
rtems_configuration_table *configuration,
rtems_unsigned32 number_of_devices

View File

@@ -894,9 +894,10 @@ rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len)
* device transmit interrupt handler.
* The second argument is the number of characters transmitted so far.
* This value will always be 1 for devices which generate an interrupt
* for each transmitted character.
* for each transmitted character.
* It returns number of characters left to transmit
*/
void
int
rtems_termios_dequeue_characters (void *ttyp, int len)
{
struct rtems_termios_tty *tty = ttyp;
@@ -906,13 +907,14 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
if (tty->rawOutBufState == rob_wait)
rtems_semaphore_release (tty->rawOutBufSemaphore);
if ( tty->rawOutBufHead == tty->rawOutBufTail )
return;
return 0;
newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE;
if (newTail == tty->rawOutBufHead) {
/*
* Buffer empty
*/
tty->rawOutBufState = rob_idle;
nToSend = 0;
}
else {
/*
@@ -926,4 +928,8 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
tty->rawOutBufState = rob_busy;
}
tty->rawOutBufTail = newTail;
return nToSend;
}

View File

@@ -46,13 +46,6 @@ rtems_raw_irq_hdl get_hdl_from_vector(rtems_vector_offset index)
i386_get_info_from_IDTR (&idt_entry_tbl, &limit);
/* Convert limit into number of entries */
limit = (limit + 1) >> 3;
if(index >= limit) {
return 0;
}
/* Convert limit into number of entries */
limit = (limit + 1) / sizeof(interrupt_gate_descriptor);
@@ -279,7 +272,7 @@ int i386_set_gdt_entry (unsigned short segment_selector, unsigned base,
gdt_entry_tbl[segment_selector].present = 1; /* not present */
/*
return 1;
* Now, reload all segment registers so the limit takes effect.
*/
asm volatile( "movw %%ds,%0 ; movw %0,%%ds

View File

@@ -46,13 +46,6 @@ rtems_raw_irq_hdl get_hdl_from_vector(rtems_vector_offset index)
i386_get_info_from_IDTR (&idt_entry_tbl, &limit);
/* Convert limit into number of entries */
limit = (limit + 1) >> 3;
if(index >= limit) {
return 0;
}
/* Convert limit into number of entries */
limit = (limit + 1) / sizeof(interrupt_gate_descriptor);
@@ -279,7 +272,7 @@ int i386_set_gdt_entry (unsigned short segment_selector, unsigned base,
gdt_entry_tbl[segment_selector].present = 1; /* not present */
/*
return 1;
* Now, reload all segment registers so the limit takes effect.
*/
asm volatile( "movw %%ds,%0 ; movw %0,%%ds

View File

@@ -157,7 +157,7 @@ rtems_status_code rtems_termios_read (void *arg);
rtems_status_code rtems_termios_write (void *arg);
rtems_status_code rtems_termios_ioctl (void *arg);
int rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len);
void rtems_termios_dequeue_characters (void *ttyp, int len);
int rtems_termios_dequeue_characters (void *ttyp, int len);
void rtems_termios_reserve_resources(
rtems_configuration_table *configuration,
rtems_unsigned32 number_of_devices

View File

@@ -894,9 +894,10 @@ rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len)
* device transmit interrupt handler.
* The second argument is the number of characters transmitted so far.
* This value will always be 1 for devices which generate an interrupt
* for each transmitted character.
* for each transmitted character.
* It returns number of characters left to transmit
*/
void
int
rtems_termios_dequeue_characters (void *ttyp, int len)
{
struct rtems_termios_tty *tty = ttyp;
@@ -906,13 +907,14 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
if (tty->rawOutBufState == rob_wait)
rtems_semaphore_release (tty->rawOutBufSemaphore);
if ( tty->rawOutBufHead == tty->rawOutBufTail )
return;
return 0;
newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE;
if (newTail == tty->rawOutBufHead) {
/*
* Buffer empty
*/
tty->rawOutBufState = rob_idle;
nToSend = 0;
}
else {
/*
@@ -926,4 +928,8 @@ rtems_termios_dequeue_characters (void *ttyp, int len)
tty->rawOutBufState = rob_busy;
}
tty->rawOutBufTail = newTail;
return nToSend;
}

View File

@@ -39,6 +39,7 @@ RTEMS_CROSS_TARGET=@rtems_cv_prog_cc_cross@
RTEMS_HOST = @RTEMS_HOST@
RTEMS_USE_OWN_PDIR = @RTEMS_USE_OWN_PDIR@
RTEMS_HAS_POSIX_API = @RTEMS_HAS_POSIX_API@
RTEMS_HAS_POSIX_1H_API = @RTEMS_HAS_POSIX_1H_API@
RTEMS_HAS_NETWORKING = @RTEMS_HAS_NETWORKING@
RTEMS_HAS_CPLUSPLUS = @RTEMS_HAS_CPLUSPLUS@
RTEMS_USE_MACROS = @RTEMS_USE_MACROS@