Skip to content

Commit 3372459

Browse files
JasonLin-RealTekjhedberg
authored andcommitted
serial: uart_ns16550: add uart_ns16550_get_port() function
For user to get the register address of the device by this function Signed-off-by: Lin Yu-Cheng <[email protected]>
1 parent 5bca309 commit 3372459

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

drivers/serial/uart_ns16550.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,13 @@ struct uart_ns16550_dev_data {
384384
#endif
385385
};
386386

387+
uint32_t uart_ns16550_get_port(const struct device *dev)
388+
{
389+
const struct uart_ns16550_dev_config *config = dev->config;
390+
391+
return config->port;
392+
}
393+
387394
static void ns16550_outbyte(const struct uart_ns16550_dev_config *cfg,
388395
uintptr_t port, uint8_t val)
389396
{

include/zephyr/drivers/serial/uart_ns16550.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@
2020
*/
2121
#define CMD_SET_DLF 0x01
2222

23+
/**
24+
* @brief Get the device address from uart_ns16550.
25+
*
26+
* @param dev UART device instance
27+
*/
28+
uint32_t uart_ns16550_get_port(const struct device *dev);
29+
2330
#endif /* ZEPHYR_INCLUDE_DRIVERS_SERIAL_UART_NS16550_H_ */

0 commit comments

Comments
 (0)