Changeset a35b458 in mainline for uspace/drv/intctl
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- Location:
- uspace/drv/intctl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/intctl/apic/apic.c
r3061bc1 ra35b458 169 169 ipc_call_t call; 170 170 apic_t *apic; 171 171 172 172 /* 173 173 * Answer the first IPC_M_CONNECT_ME_TO call. 174 174 */ 175 175 async_answer_0(iid, EOK); 176 176 177 177 apic = (apic_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg)); 178 178 179 179 while (true) { 180 180 callid = async_get_call(&call); 181 181 182 182 if (!IPC_GET_IMETHOD(call)) { 183 183 /* The other side has hung up. */ … … 185 185 return; 186 186 } 187 187 188 188 switch (IPC_GET_IMETHOD(call)) { 189 189 case IRC_ENABLE_INTERRUPT: … … 213 213 void *regs; 214 214 errno_t rc; 215 215 216 216 if ((sysinfo_get_value("apic", &have_apic) != EOK) || (!have_apic)) { 217 217 printf("%s: No APIC found\n", NAME); 218 218 return ENOTSUP; 219 219 } 220 220 221 221 rc = pio_enable((void *) res->base, IO_APIC_SIZE, ®s); 222 222 if (rc != EOK) { -
uspace/drv/intctl/i8259/i8259.c
r3061bc1 ra35b458 68 68 if (irq > PIC_MAX_IRQ) 69 69 return ENOENT; 70 70 71 71 uint16_t irqmask = 1 << irq; 72 72 uint8_t val; 73 73 74 74 if (irqmask & 0xff) { 75 75 val = pio_read_8(i8259->regs0 + PIC_PIC0PORT2); … … 77 77 (uint8_t) (val & (~(irqmask & 0xff)))); 78 78 } 79 79 80 80 if (irqmask >> 8) { 81 81 val = pio_read_8(i8259->regs1 + PIC_PIC1PORT2); … … 83 83 (uint8_t) (val & (~(irqmask >> 8)))); 84 84 } 85 85 86 86 return EOK; 87 87 } … … 98 98 ipc_call_t call; 99 99 i8259_t *i8259 = NULL /* XXX */; 100 100 101 101 /* 102 102 * Answer the first IPC_M_CONNECT_ME_TO call. 103 103 */ 104 104 async_answer_0(iid, EOK); 105 105 106 106 i8259 = (i8259_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg)); 107 107 108 108 while (true) { 109 109 callid = async_get_call(&call); 110 110 111 111 if (!IPC_GET_IMETHOD(call)) { 112 112 /* The other side has hung up. */ … … 114 114 return; 115 115 } 116 116 117 117 switch (IPC_GET_IMETHOD(call)) { 118 118 case IRC_ENABLE_INTERRUPT: … … 143 143 ddf_fun_t *fun_a = NULL; 144 144 errno_t rc; 145 145 146 146 if ((sysinfo_get_value("i8259", &have_i8259) != EOK) || (!have_i8259)) { 147 147 printf("%s: No i8259 found\n", NAME); 148 148 return ENOTSUP; 149 149 } 150 150 151 151 if ((pio_enable((void *) res->base0, IO_RANGE0_SIZE, 152 152 (void **) ®s0) != EOK) || … … 156 156 return EIO; 157 157 } 158 158 159 159 i8259->regs0 = regs0; 160 160 i8259->regs1 = regs1; 161 161 162 162 fun_a = ddf_fun_create(i8259->dev, fun_exposed, "a"); 163 163 if (fun_a == NULL) { … … 166 166 goto error; 167 167 } 168 168 169 169 ddf_fun_set_conn_handler(fun_a, i8259_connection); 170 170 171 171 rc = ddf_fun_bind(fun_a); 172 172 if (rc != EOK) { … … 174 174 goto error; 175 175 } 176 176 177 177 rc = ddf_fun_add_to_category(fun_a, "irc"); 178 178 if (rc != EOK) 179 179 goto error; 180 180 181 181 return EOK; 182 182 error:
Note:
See TracChangeset
for help on using the changeset viewer.