Changeset 8a9a41e in mainline for kernel/genarch/src/drivers/ns16550/ns16550.c
- Timestamp:
- 2021-10-24T08:28:43Z (4 years ago)
- Children:
- 9ea3a41
- Parents:
- 2ce943a (diff), cd981f2a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Erik Kučák <35500848+Riko196@…> (2021-10-24 08:28:43)
- git-committer:
- GitHub <noreply@…> (2021-10-24 08:28:43)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/ns16550/ns16550.c
r2ce943a r8a9a41e 132 132 }; 133 133 134 /** Configure ns16550 transmission format. 135 * 136 * @param instance NS 16550 driver instance. 137 * @param baud_rate Transmission speed in bits per second, also known as baud, 138 * maximum value is 115200. 139 * @param lcr_format Line Control Register configuration bits, as defined by 140 * the @c LCR_ macros. These configure the word width, 141 * parity type, and stop bit count. 142 */ 143 void ns16550_format_set(ns16550_instance_t *instance, 144 unsigned baud_rate, uint8_t lcr_format) 145 { 146 uint16_t divisor; 147 148 divisor = (uint16_t)(NS156440_CLOCK / baud_rate); 149 if (divisor == 0) 150 divisor = 1; /* Avoid division by zero. */ 151 152 ns16550_reg_write(instance, NS16550_REG_LCR, LCR_DLAB); 153 ns16550_reg_write(instance, NS16550_REG_DLL, divisor & 0xFF); 154 ns16550_reg_write(instance, NS16550_REG_DLH, (divisor >> 8) & 0xFF); 155 ns16550_reg_write(instance, NS16550_REG_LCR, lcr_format & ~LCR_DLAB); 156 } 157 134 158 /** Initialize ns16550. 135 159 *
Note:
See TracChangeset
for help on using the changeset viewer.