Changeset 3c79afe in mainline for kernel/genarch/src/drivers/i8042/i8042.c
- Timestamp:
- 2009-03-12T17:54:24Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3a1c048
- Parents:
- a0e1b48
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/i8042/i8042.c
ra0e1b48 r3c79afe 27 27 */ 28 28 29 /** @addtogroup genarch 29 /** @addtogroup genarch 30 30 * @{ 31 31 */ 32 32 /** 33 33 * @file 34 * @brief 34 * @brief i8042 processor driver 35 35 * 36 36 * It takes care of the i8042 serial communication. … … 43 43 #include <mm/slab.h> 44 44 45 #define i8042_SET_COMMAND 0x60 46 #define i8042_COMMAND 0x69 45 indev_operations_t kbrdin_ops = { 46 .poll = NULL 47 }; 47 48 48 #define i8042_BUFFER_FULL_MASK 0x01 49 #define i8042_WAIT_MASK 0x02 49 #define i8042_SET_COMMAND 0x60 50 #define i8042_COMMAND 0x69 51 52 #define i8042_BUFFER_FULL_MASK 0x01 53 #define i8042_WAIT_MASK 0x02 50 54 51 55 static irq_ownership_t i8042_claim(irq_t *irq) … … 53 57 i8042_instance_t *i8042_instance = irq->instance; 54 58 i8042_t *dev = i8042_instance->i8042; 59 55 60 if (pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK) 56 61 return IRQ_ACCEPT; … … 63 68 i8042_instance_t *instance = irq->instance; 64 69 i8042_t *dev = instance->i8042; 65 66 uint8_t data;67 70 uint8_t status; 68 71 69 72 if (((status = pio_read_8(&dev->status)) & i8042_BUFFER_FULL_MASK)) { 70 data = pio_read_8(&dev->data); 71 72 if (instance->devout) 73 chardev_push_character(instance->devout, data); 73 uint8_t data = pio_read_8(&dev->data); 74 indev_push_character(&instance->kbrdin, data); 74 75 } 75 76 } 76 77 77 78 /** Initialize i8042. */ 78 bool 79 i8042_init(i8042_t *dev, devno_t devno, inr_t inr, chardev_t *devout) 79 indev_t *i8042_init(i8042_t *dev, devno_t devno, inr_t inr) 80 80 { 81 i8042_instance_t *instance; 82 83 instance = malloc(sizeof(i8042_instance_t), FRAME_ATOMIC); 81 i8042_instance_t *instance 82 = malloc(sizeof(i8042_instance_t), FRAME_ATOMIC); 84 83 if (!instance) 85 return false; 84 return NULL; 85 86 indev_initialize("i8042", &instance->kbrdin, &kbrdin_ops); 86 87 87 88 instance->devno = devno; 88 89 instance->i8042 = dev; 89 instance->devout = devout;90 90 91 91 irq_initialize(&instance->irq); … … 103 103 (void) pio_read_8(&dev->data); 104 104 105 return true;105 return &instance->kbrdin; 106 106 } 107 107
Note:
See TracChangeset
for help on using the changeset viewer.