Subversion Repositories HelenOS

Rev

Rev 1923 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1923 Rev 1925
Line 60... Line 60...
60
#define IGNORE_CODE 0x7f        /* all keys up */
60
#define IGNORE_CODE 0x7f        /* all keys up */
61
 
61
 
62
static z8530_t z8530;       /**< z8530 device structure. */
62
static z8530_t z8530;       /**< z8530 device structure. */
63
static irq_t z8530_irq;     /**< z8530's IRQ. */
63
static irq_t z8530_irq;     /**< z8530's IRQ. */
64
 
64
 
-
 
65
static ipc_notif_cfg_t saved_notif_cfg;
-
 
66
 
65
static void z8530_suspend(chardev_t *);
67
static void z8530_suspend(chardev_t *);
66
static void z8530_resume(chardev_t *);
68
static void z8530_resume(chardev_t *);
67
 
69
 
68
static chardev_operations_t ops = {
70
static chardev_operations_t ops = {
69
    .suspend = z8530_suspend,
71
    .suspend = z8530_suspend,
Line 72... Line 74...
72
};
74
};
73
 
75
 
74
/** Initialize keyboard and service interrupts using kernel routine. */
76
/** Initialize keyboard and service interrupts using kernel routine. */
75
void z8530_grab(void)
77
void z8530_grab(void)
76
{
78
{
-
 
79
    (void) z8530_read_a(&z8530, RR8);
-
 
80
 
-
 
81
    /*
-
 
82
     * Clear any pending TX interrupts or we never manage
-
 
83
     * to set FHC UART interrupt state to idle.
-
 
84
     */
-
 
85
    z8530_write_a(&z8530, WR0, WR0_TX_IP_RST);
-
 
86
 
-
 
87
    z8530_write_a(&z8530, WR1, WR1_IARCSC);     /* interrupt on all characters */
-
 
88
 
-
 
89
    /* 8 bits per character and enable receiver */
-
 
90
    z8530_write_a(&z8530, WR3, WR3_RX8BITSCH | WR3_RX_ENABLE);
-
 
91
   
-
 
92
    z8530_write_a(&z8530, WR9, WR9_MIE);        /* Master Interrupt Enable. */
-
 
93
   
-
 
94
    if (z8530_irq.notif_cfg.answerbox) {
-
 
95
        saved_notif_cfg = z8530_irq.notif_cfg;
-
 
96
        z8530_irq.notif_cfg.answerbox = NULL;
-
 
97
        z8530_irq.notif_cfg.code = NULL;
-
 
98
        z8530_irq.notif_cfg.method = 0;
-
 
99
        z8530_irq.notif_cfg.counter = 0;
-
 
100
    }
77
}
101
}
78
 
102
 
79
/** Resume the former IPC notification behavior. */
103
/** Resume the former IPC notification behavior. */
80
void z8530_release(void)
104
void z8530_release(void)
81
{
105
{
-
 
106
    if (saved_notif_cfg.answerbox)
-
 
107
        z8530_irq.notif_cfg = saved_notif_cfg;
82
}
108
}
83
 
109
 
84
/** Initialize z8530. */
110
/** Initialize z8530. */
85
void z8530_init(devno_t devno, inr_t inr, uintptr_t vaddr)
111
void z8530_init(devno_t devno, inr_t inr, uintptr_t vaddr)
86
{
112
{
Line 100... Line 126...
100
    sysinfo_set_item_val("kbd", NULL, true);
126
    sysinfo_set_item_val("kbd", NULL, true);
101
    sysinfo_set_item_val("kbd.devno", NULL, devno);
127
    sysinfo_set_item_val("kbd.devno", NULL, devno);
102
    sysinfo_set_item_val("kbd.inr", NULL, inr);
128
    sysinfo_set_item_val("kbd.inr", NULL, inr);
103
    sysinfo_set_item_val("kbd.address.virtual", NULL, vaddr);
129
    sysinfo_set_item_val("kbd.address.virtual", NULL, vaddr);
104
 
130
 
105
    (void) z8530_read_a(&z8530, RR8);
131
    z8530_grab();
106
 
-
 
107
    /*
-
 
108
     * Clear any pending TX interrupts or we never manage
-
 
109
     * to set FHC UART interrupt state to idle.
-
 
110
     */
-
 
111
    z8530_write_a(&z8530, WR0, WR0_TX_IP_RST);
-
 
112
 
-
 
113
    z8530_write_a(&z8530, WR1, WR1_IARCSC);     /* interrupt on all characters */
-
 
114
 
-
 
115
    /* 8 bits per character and enable receiver */
-
 
116
    z8530_write_a(&z8530, WR3, WR3_RX8BITSCH | WR3_RX_ENABLE);
-
 
117
   
-
 
118
    z8530_write_a(&z8530, WR9, WR9_MIE);        /* Master Interrupt Enable. */
-
 
119
}
132
}
120
 
133
 
121
/** Process z8530 interrupt.
134
/** Process z8530 interrupt.
122
 *
135
 *
123
 * @param n Interrupt vector.
136
 * @param n Interrupt vector.