RTEMS | bsps/zynq-uart: fix parity configuration handling (!1212)

SHIVAM DEOLANKAR (@D3athSkulll) gitlab at rtems.org
Tue Apr 21 04:30:58 UTC 2026




SHIVAM DEOLANKAR commented on a discussion: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1212#note_148825


```ini
[DEFAULT]
RTEMS_POSIX_API = True
BUILD_TESTS = True
[aarch64/zynqmp_apu]
```

This was the config.ini used.

The build was successful with waf.

I tried using a testcode for the test and tried fetching result on qemu but it failed starting uart service. 

The logic solves the issue so analytically this is a viable fix.

This was the qemu configuration command used.

```
qemu-system-aarch64 -no-reboot -nographic -serial mon:stdio  -machine xlnx-zcu102 
-m 4096 -kernel /home/shivam/quick-start/src/rtems/build/aarch64/zynqmp_apu/testsuites/samples/hello.exe
```

This was the test configuration used.

```
/* SPDX-License-Identifier: BSD-2-Clause */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <rtems.h>
#include <tmacros.h>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <dirent.h>
#include <stdio.h>

const char rtems_test_name[] = "UART PARITY TEST";

static rtems_task Init(rtems_task_argument ignored)
{
  (void) ignored;

  TEST_BEGIN();

  /* List devices */
  printf("Devices:\n");
  DIR *d = opendir("/dev");
  struct dirent *dir;

  if (d) {
    while ((dir = readdir(d)) != NULL) {
      printf("%s\n", dir->d_name);
    }
    closedir(d);
  } else {
    printf("Failed to open /dev\n");
  }

  /* Open UART (console) */
  int fd = open("/dev/console", O_RDWR);
  if (fd < 0) {
    printf("UART open failed\n");
    rtems_test_exit(0);
  }

  printf("UART open successful\n");

  /* Get current settings */
  struct termios t;
  if (tcgetattr(fd, &t) != 0) {
    printf("tcgetattr failed\n");
    close(fd);
    rtems_test_exit(0);
  }

  /* Set ODD parity */
  t.c_cflag &= ~(PARENB | PARODD);
  t.c_cflag |= PARENB | PARODD;

  if (tcsetattr(fd, TCSANOW, &t) != 0) {
    printf("tcsetattr failed\n");
    close(fd);
    rtems_test_exit(0);
  }

  printf("Sending byte with parity enabled...\n");

  /* Ensure TX buffer is flushed */
  tcdrain(fd);

  /* Send test byte */
  write(fd, "A", 1);

  close(fd);

  TEST_END();
  rtems_test_exit(0);
}

/* Configuration */

#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER

#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
#define CONFIGURE_FILESYSTEM_DEVFS

#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION

#define CONFIGURE_INIT
#include <rtems/confdefs.h>
```

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1212#note_148825
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/20260421/5cac770b/attachment-0001.htm>


More information about the bugs mailing list