Changeset f4424cfb in rtems
- Timestamp:
- Aug 9, 2018, 7:20:33 AM (2 years ago)
- Branches:
- 5, master
- Children:
- 0e6f7dc4
- Parents:
- aac36d15
- git-author:
- Sebastian Huber <sebastian.huber@…> (08/09/18 07:20:33)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (08/10/18 05:14:43)
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
bsps/sparc/include/bsp/apbuart.h
raac36d15 rf4424cfb 21 21 22 22 #include <ambapp.h> 23 #include <grlib.h> 23 24 24 25 #ifdef __cplusplus … … 54 55 #define APBUART_STATUS_RF 0x400 55 56 57 void apbuart_outbyte_polled( 58 struct apbuart_regs *regs, 59 unsigned char ch, 60 int do_cr_on_newline, 61 int wait_sent 62 ); 63 64 int apbuart_inbyte_nonblocking(struct apbuart_regs *regs); 65 56 66 #ifdef __cplusplus 57 67 } -
bsps/sparc/include/bsp/apbuart_termios.h
raac36d15 rf4424cfb 35 35 const rtems_termios_device_handler apbuart_handler_polled; 36 36 37 /*38 * apbuart_outbyte_polled39 *40 * This routine transmits a character using polling.41 */42 void apbuart_outbyte_polled(43 struct apbuart_regs *regs,44 unsigned char ch,45 int do_cr_on_newline,46 int wait_sent47 );48 49 /*50 * apbuart_inbyte_nonblocking51 *52 * This routine polls for a character.53 */54 int apbuart_inbyte_nonblocking(struct apbuart_regs *regs);55 56 37 #ifdef __cplusplus 57 38 } -
bsps/sparc/leon3/console/printk_support.c
raac36d15 rf4424cfb 24 24 #include <stdio.h> 25 25 #include <bsp/apbuart.h> 26 #include <bsp/apbuart_termios.h>27 26 28 27 int leon3_debug_uart_index __attribute__((weak)) = 0; -
bsps/sparc/shared/uart/apbuart_cons.c
raac36d15 rf4424cfb 43 43 44 44 /* LEON3 Low level transmit/receive functions provided by debug-uart code */ 45 extern void apbuart_outbyte_polled(46 struct apbuart_regs *regs,47 unsigned char ch,48 int do_cr_on_newline,49 int wait_sent);50 extern int apbuart_inbyte_nonblocking(struct apbuart_regs *regs);51 45 #ifdef LEON3 52 46 extern struct apbuart_regs *leon3_debug_uart; /* The debug UART */ … … 386 380 #endif 387 381 388 #ifndef LEON3389 /* This routine transmits a character, it will busy-wait until on character390 * fits in the APBUART Transmit FIFO391 */392 void apbuart_outbyte_polled(393 struct apbuart_regs *regs,394 unsigned char ch,395 int do_cr_on_newline,396 int wait_sent)397 {398 send:399 while ((regs->status & LEON_REG_UART_STATUS_THE) == 0) {400 /* Lower bus utilization while waiting for UART */401 asm volatile ("nop"::); asm volatile ("nop"::);402 asm volatile ("nop"::); asm volatile ("nop"::);403 asm volatile ("nop"::); asm volatile ("nop"::);404 asm volatile ("nop"::); asm volatile ("nop"::);405 }406 regs->data = (unsigned int) ch;407 408 if ((ch == '\n') && do_cr_on_newline) {409 ch = '\r';410 goto send;411 }412 413 /* Wait until the character has been sent? */414 if (wait_sent) {415 while ((regs->status & LEON_REG_UART_STATUS_THE) == 0)416 ;417 }418 }419 420 /* This routine polls for one character, return EOF if no character is available */421 int apbuart_inbyte_nonblocking(struct apbuart_regs *regs)422 {423 if (regs->status & LEON_REG_UART_STATUS_ERR) {424 regs->status = ~LEON_REG_UART_STATUS_ERR;425 }426 427 if ((regs->status & LEON_REG_UART_STATUS_DR) == 0)428 return EOF;429 430 return (int)regs->data;431 }432 #endif433 434 382 static bool first_open( 435 383 rtems_termios_tty *tty, -
bsps/sparc/shared/uart/apbuart_termios.c
raac36d15 rf4424cfb 243 243 } 244 244 245 /*246 * apbuart_outbyte_polled247 *248 * This routine transmits a character using polling.249 */250 void apbuart_outbyte_polled(251 struct apbuart_regs *regs,252 unsigned char ch,253 int do_cr_on_newline,254 int wait_sent255 )256 {257 send:258 while ( (regs->status & APBUART_STATUS_TE) == 0 ) {259 /* Lower bus utilization while waiting for UART */260 __asm__ volatile ("nop"::); __asm__ volatile ("nop"::);261 __asm__ volatile ("nop"::); __asm__ volatile ("nop"::);262 __asm__ volatile ("nop"::); __asm__ volatile ("nop"::);263 __asm__ volatile ("nop"::); __asm__ volatile ("nop"::);264 }265 266 if ((ch == '\n') && do_cr_on_newline) {267 regs->data = (unsigned int) '\r';268 do_cr_on_newline = 0;269 goto send;270 }271 regs->data = (unsigned int) ch;272 273 /* Wait until the character has been sent? */274 if (wait_sent) {275 while ((regs->status & APBUART_STATUS_TE) == 0)276 ;277 }278 }279 280 /*281 * apbuart_inbyte_nonblocking282 *283 * This routine polls for a character.284 */285 int apbuart_inbyte_nonblocking(struct apbuart_regs *regs)286 {287 /* Clear errors */288 if (regs->status & APBUART_STATUS_ERR)289 regs->status = ~APBUART_STATUS_ERR;290 291 if ((regs->status & APBUART_STATUS_DR) == 0)292 return -1;293 else294 return (int) regs->data;295 }296 297 245 const rtems_termios_device_handler apbuart_handler_interrupt = { 298 246 .first_open = apbuart_first_open_interrupt, -
c/src/lib/libbsp/sparc/leon3/Makefile.am
raac36d15 rf4424cfb 69 69 librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/uart/cons.c 70 70 librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/uart/apbuart_cons.c 71 librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/uart/apbuart_polled.c 72 librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/uart/apbuart_termios.c 71 73 # debugio 72 74 librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon3/console/printk_support.c … … 117 119 librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/spw/grspw_pkt.c 118 120 librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/spw/grspw_router.c 119 120 # UART121 librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/uart/apbuart_termios.c122 121 123 122 # I2CMST
Note: See TracChangeset
for help on using the changeset viewer.