RTEMS | Issuearm/raspberrypi: Serial port no input possible (#5260)
Heinz Junkes (@junkes)
gitlab at rtems.org
Mon Jun 9 19:38:55 UTC 2025
Heinz Junkes commented: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5260#note_123248
If I define my own poll routine:
```
#define PL011_UART_BASE 0x3F201000
typedef int (*BSP_polling_getchar_function_type)(void);
extern BSP_polling_getchar_function_type BSP_poll_char;
static int pl011_poll_getchar(void)
{
volatile uint32_t *regs = (volatile uint32_t *) PL011_UART_BASE;
if (regs[0x18 / sizeof(uint32_t)] & (1 << 4)) { return -1; } // UART_FR_RXFE
return (regs[0] & 0xFF);
}
```
and let this 'BSP_poll_char' point to :
```
BSP_poll_char = pl011_poll_getchar;
```
the RTEMS shell reads the input automatically ("/dev/console" ?).
```
#if 1
// debugger_config();
// Start an rtems shell before main, for debugging RTEMS system issues
rtems_shell_init("SHLL", RTEMS_MINIMUM_STACK_SIZE * 4,
100, "/dev/console",
false, true,
NULL);
#endif
```
and I can read the input like this:
```
void *readInput(void * arg)
{
char inputBuffer[MAX_INPUT] = {0};
while (readActive) {
printf("Task read new timing value\n");
int i = 0;
memset(inputBuffer,0,MAX_INPUT);
do {
inputBuffer[i++] = getchar();
//printf("inputBuffer = %s\n", inputBuffer);
//printf("inputBuffer[%d-1] = 0x%x\n", i, inputBuffer[i-1]);
} while (i < MAX_INPUT-1 && inputBuffer[i-1] != 0x0a && inputBuffer[i-1] != 0x0d);
inputBuffer[i-1] = 0;
sscanf(inputBuffer,"%d", &newTimingValue);
if(newTimingValue == 9876) readActive = 0;
else printf(" New timing value = %d ms\n", newTimingValue);
}
}
```
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5260#note_123248
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250609/a9b8cd1e/attachment-0001.htm>
More information about the bugs
mailing list