/* * HP i8042 System Device Controller -- header * * Copyright (c) 2001 Brian S. Julin * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions, and the following disclaimer, * without modification. * 2. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL"). * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * * References: * * HP-HIL Technical Reference Manual. Hewlett Packard Product No. 45918A * * System Device Controller Microprocessor Firmware Theory of Operation * for Part Number 1820-4784 Revision B. Dwg No. A-1820-4784-2 *
*/
int hp_sdc_request_timer_irq(hp_sdc_irqhook *callback); int hp_sdc_request_hil_irq(hp_sdc_irqhook *callback); int hp_sdc_request_cooked_irq(hp_sdc_irqhook *callback); int hp_sdc_release_timer_irq(hp_sdc_irqhook *callback); int hp_sdc_release_hil_irq(hp_sdc_irqhook *callback); int hp_sdc_release_cooked_irq(hp_sdc_irqhook *callback);
typedefstruct { int actidx; /* Start of act. Acts are atomic WRT I/O to SDC */ int idx; /* Index within the act */ int endidx; /* transaction is over and done if idx == endidx */
uint8_t *seq; /* commands/data for the transaction */ union {
hp_sdc_irqhook *irqhook; /* Callback, isr or tasklet context */ struct semaphore *semaphore; /* Semaphore to sleep on. */
} act;
} hp_sdc_transaction; int __hp_sdc_enqueue_transaction(hp_sdc_transaction *this); int hp_sdc_enqueue_transaction(hp_sdc_transaction *this); int hp_sdc_dequeue_transaction(hp_sdc_transaction *this);
/* The HP_SDC_ACT* values are peculiar to this driver. * Nuance: never HP_SDC_ACT_DATAIN | HP_SDC_ACT_DEALLOC, use another * act to perform the dealloc.
*/ #define HP_SDC_ACT_PRECMD 0x01 /* Send a command first */ #define HP_SDC_ACT_DATAREG 0x02 /* Set data registers */ #define HP_SDC_ACT_DATAOUT 0x04 /* Send data bytes */ #define HP_SDC_ACT_POSTCMD 0x08 /* Send command after */ #define HP_SDC_ACT_DATAIN 0x10 /* Collect data after */ #define HP_SDC_ACT_DURING 0x1f #define HP_SDC_ACT_SEMAPHORE 0x20 /* Raise semaphore after */ #define HP_SDC_ACT_CALLBACK 0x40 /* Pass data to IRQ handler */ #define HP_SDC_ACT_DEALLOC 0x80 /* Destroy transaction after */ #define HP_SDC_ACT_AFTER 0xe0 #define HP_SDC_ACT_DEAD 0x60 /* Act timed out. */
/* Rest of the flags are straightforward representation of the SDC interface */ #define HP_SDC_STATUS_IBF 0x02 /* Input buffer full */
#define HP_SDC_STATUS_IRQMASK 0xf0 /* Bits containing "level 1" irq */ #define HP_SDC_STATUS_PERIODIC 0x10 /* Periodic 10ms timer */ #define HP_SDC_STATUS_USERTIMER 0x20 /* "Special purpose" timer */ #define HP_SDC_STATUS_TIMER 0x30 /* Both PERIODIC and USERTIMER */ #define HP_SDC_STATUS_REG 0x40 /* Data from an i8042 register */ #define HP_SDC_STATUS_HILCMD 0x50 /* Command from HIL MLC */ #define HP_SDC_STATUS_HILDATA 0x60 /* Data from HIL MLC */ #define HP_SDC_STATUS_PUP 0x70 /* Successful power-up self test */ #define HP_SDC_STATUS_KCOOKED 0x80 /* Key from cooked kbd */ #define HP_SDC_STATUS_KRPG 0xc0 /* Key from Repeat Gen */ #define HP_SDC_STATUS_KMOD_SUP 0x10 /* Shift key is up */ #define HP_SDC_STATUS_KMOD_CUP 0x20 /* Control key is up */
#define HP_SDC_NMISTATUS_FHS 0x40 /* NMI is a fast handshake irq */
/* Internal i8042 registers (there are more, but they are not too useful). */
/* Values used to (de)mangle input/output to/from the HIL MLC */ #define HP_SDC_DATA 0x40 /* Data from an 8042 register */ #define HP_SDC_HIL_CMD 0x50 /* Data from HIL MLC R1/8042 */ #define HP_SDC_HIL_R1MASK 0x0f /* Contents of HIL MLC R1 0:3 */ #define HP_SDC_HIL_AUTO 0x10 /* Set if POL results from i8042 */ #define HP_SDC_HIL_ISERR 0x80 /* Has meaning as in next 4 values */ #define HP_SDC_HIL_RC_DONE 0x80 /* i8042 auto-configured loop */ #define HP_SDC_HIL_ERR 0x81 /* HIL MLC R2 had a bit set */ #define HP_SDC_HIL_TO 0x82 /* i8042 HIL watchdog expired */ #define HP_SDC_HIL_RC 0x84 /* i8042 is auto-configuring loop */ #define HP_SDC_HIL_DAT 0x60 /* Data from HIL MLC R0 */
uint8_t im; /* Interrupt mask */ int set_im; /* Interrupt mask needs to be set. */
int ibf; /* Last known status of IBF flag */
uint8_t wi; /* current i8042 write index */
uint8_t r7[4]; /* current i8042[0x70 - 0x74] values */
uint8_t r11, r7e; /* Values from version/revision regs */
hp_sdc_irqhook *timer, *reg, *hil, *pup, *cooked;
#define HP_SDC_QUEUE_LEN 16
hp_sdc_transaction *tq[HP_SDC_QUEUE_LEN]; /* All pending read/writes */
int rcurr, rqty; /* Current read transact in process */
ktime_t rtime; /* Time when current read started */ int wcurr; /* Current write transact in process */
int dev_err; /* carries status from registration */ #ifdefined(__hppa__) struct parisc_device *dev; #elifdefined(__mc68000__) void *dev; #else #error No support for device registration on this arch yet. #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.