-
Notifications
You must be signed in to change notification settings - Fork 1.2k
qurt: Add support for Qualcomm QuRT #4845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| //! Header: `errno.h` | ||
|
|
||
| use crate::prelude::*; | ||
|
|
||
| // Standard error codes - verified to match QuRT SDK | ||
| pub const EPERM: c_int = 1; | ||
| pub const ENOENT: c_int = 2; | ||
| pub const ESRCH: c_int = 3; | ||
| pub const EINTR: c_int = 4; | ||
| pub const EIO: c_int = 5; | ||
| pub const ENXIO: c_int = 6; | ||
| pub const E2BIG: c_int = 7; | ||
| pub const ENOEXEC: c_int = 8; | ||
| pub const EBADF: c_int = 9; | ||
| pub const ECHILD: c_int = 10; | ||
| pub const EAGAIN: c_int = 11; | ||
| pub const ENOMEM: c_int = 12; | ||
| pub const EACCES: c_int = 13; | ||
| pub const EFAULT: c_int = 14; | ||
| pub const ENOTBLK: c_int = 15; | ||
| pub const EBUSY: c_int = 16; | ||
| pub const EEXIST: c_int = 17; | ||
| pub const EXDEV: c_int = 18; | ||
| pub const ENODEV: c_int = 19; | ||
| pub const ENOTDIR: c_int = 20; | ||
| pub const EISDIR: c_int = 21; | ||
| pub const EINVAL: c_int = 22; | ||
| pub const ENFILE: c_int = 23; | ||
| pub const EMFILE: c_int = 24; | ||
| pub const ENOTTY: c_int = 25; | ||
| pub const ETXTBSY: c_int = 26; | ||
| pub const EFBIG: c_int = 27; | ||
| pub const ENOSPC: c_int = 28; | ||
| pub const ESPIPE: c_int = 29; | ||
| pub const EROFS: c_int = 30; | ||
| pub const EMLINK: c_int = 31; | ||
| pub const EPIPE: c_int = 32; | ||
| pub const EDOM: c_int = 33; | ||
| pub const ERANGE: c_int = 34; | ||
| pub const EDEADLK: c_int = 35; | ||
| pub const ENAMETOOLONG: c_int = 36; | ||
| pub const ENOLCK: c_int = 37; | ||
| pub const ENOSYS: c_int = 38; | ||
| pub const ENOTEMPTY: c_int = 39; | ||
| pub const ELOOP: c_int = 40; | ||
| pub const EWOULDBLOCK: c_int = EAGAIN; | ||
| pub const ENOMSG: c_int = 42; | ||
| pub const EIDRM: c_int = 43; | ||
| pub const ECHRNG: c_int = 44; | ||
| pub const EL2NSYNC: c_int = 45; | ||
| pub const EL3HLT: c_int = 46; | ||
| pub const EL3RST: c_int = 47; | ||
| pub const ELNRNG: c_int = 48; | ||
| pub const EUNATCH: c_int = 49; | ||
| pub const ENOCSI: c_int = 50; | ||
| pub const EL2HLT: c_int = 51; | ||
| pub const EBADE: c_int = 52; | ||
| pub const EBADR: c_int = 53; | ||
| pub const EXFULL: c_int = 54; | ||
| pub const ENOANO: c_int = 55; | ||
| pub const EBADRQC: c_int = 56; | ||
| pub const EBADSLT: c_int = 57; | ||
| pub const EDEADLOCK: c_int = EDEADLK; | ||
| pub const EBFONT: c_int = 59; | ||
| pub const ENOSTR: c_int = 60; | ||
| pub const ENODATA: c_int = 61; | ||
| pub const ETIME: c_int = 62; | ||
| pub const ENOSR: c_int = 63; | ||
| pub const ENONET: c_int = 64; | ||
| pub const ENOPKG: c_int = 65; | ||
| pub const EREMOTE: c_int = 66; | ||
| pub const ENOLINK: c_int = 67; | ||
| pub const EADV: c_int = 68; | ||
| pub const ESRMNT: c_int = 69; | ||
| pub const ECOMM: c_int = 70; | ||
| pub const EPROTO: c_int = 71; | ||
| pub const EMULTIHOP: c_int = 72; | ||
| pub const EDOTDOT: c_int = 73; | ||
| pub const EBADMSG: c_int = 74; | ||
| pub const EOVERFLOW: c_int = 75; | ||
| pub const ENOTUNIQ: c_int = 76; | ||
| pub const EBADFD: c_int = 77; | ||
| pub const EREMCHG: c_int = 78; | ||
| pub const ELIBACC: c_int = 79; | ||
| pub const ELIBBAD: c_int = 80; | ||
| pub const ELIBSCN: c_int = 81; | ||
| pub const ELIBMAX: c_int = 82; | ||
| pub const ELIBEXEC: c_int = 83; | ||
| pub const EILSEQ: c_int = 84; | ||
| pub const ERESTART: c_int = 85; | ||
| pub const ESTRPIPE: c_int = 86; | ||
| pub const EUSERS: c_int = 87; | ||
| pub const ENOTSOCK: c_int = 88; | ||
| pub const EDESTADDRREQ: c_int = 89; | ||
| pub const EMSGSIZE: c_int = 90; | ||
| pub const EPROTOTYPE: c_int = 91; | ||
| pub const ENOPROTOOPT: c_int = 92; | ||
| pub const EPROTONOSUPPORT: c_int = 93; | ||
| pub const ESOCKTNOSUPPORT: c_int = 94; | ||
| pub const EOPNOTSUPP: c_int = 95; | ||
| pub const ENOTSUP: c_int = EOPNOTSUPP; | ||
| pub const EPFNOSUPPORT: c_int = 96; | ||
| pub const EAFNOSUPPORT: c_int = 97; | ||
| pub const EADDRINUSE: c_int = 98; | ||
| pub const EADDRNOTAVAIL: c_int = 99; | ||
| pub const ENETDOWN: c_int = 100; | ||
| pub const ENETUNREACH: c_int = 101; | ||
| pub const ENETRESET: c_int = 102; | ||
| pub const ECONNABORTED: c_int = 103; | ||
| pub const ECONNRESET: c_int = 104; | ||
| pub const ENOBUFS: c_int = 105; | ||
| pub const EISCONN: c_int = 106; | ||
| pub const ENOTCONN: c_int = 107; | ||
| pub const ESHUTDOWN: c_int = 108; | ||
| pub const ETOOMANYREFS: c_int = 109; | ||
| pub const ETIMEDOUT: c_int = 110; | ||
| pub const ECONNREFUSED: c_int = 111; | ||
| pub const EHOSTDOWN: c_int = 112; | ||
| pub const EHOSTUNREACH: c_int = 113; | ||
| pub const EALREADY: c_int = 114; | ||
| pub const EINPROGRESS: c_int = 115; | ||
| pub const ESTALE: c_int = 116; | ||
| pub const EUCLEAN: c_int = 117; | ||
| pub const ENOTNAM: c_int = 118; | ||
| pub const ENAVAIL: c_int = 119; | ||
| pub const EISNAM: c_int = 120; | ||
| pub const EREMOTEIO: c_int = 121; | ||
| pub const EDQUOT: c_int = 122; | ||
| pub const ENOMEDIUM: c_int = 123; | ||
| pub const EMEDIUMTYPE: c_int = 124; | ||
| pub const ECANCELED: c_int = 125; | ||
| pub const ENOKEY: c_int = 126; | ||
| pub const EKEYEXPIRED: c_int = 127; | ||
| pub const EKEYREVOKED: c_int = 128; | ||
| pub const EKEYREJECTED: c_int = 129; | ||
| pub const EOWNERDEAD: c_int = 130; | ||
| pub const ENOTRECOVERABLE: c_int = 131; | ||
| pub const ERFKILL: c_int = 132; | ||
| pub const EHWPOISON: c_int = 133; | ||
|
|
||
| extern "C" { | ||
| // Error number access | ||
| #[link_name = "__errno_location"] | ||
| pub fn __errno_location() -> *mut c_int; | ||
| } | ||
|
|
||
| pub unsafe fn errno() -> c_int { | ||
| *__errno_location() | ||
| } | ||
|
|
||
| pub unsafe fn set_errno(value: c_int) { | ||
| *__errno_location() = value; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| //! Header: `fcntl.h` | ||
|
|
||
| use crate::prelude::*; | ||
|
|
||
| // File access modes | ||
| pub const O_RDONLY: c_int = 0x0000; | ||
| pub const O_WRONLY: c_int = 0x0001; | ||
| pub const O_RDWR: c_int = 0x0002; | ||
| pub const O_ACCMODE: c_int = 0x0003; | ||
|
|
||
| // File creation flags | ||
| pub const O_CREAT: c_int = 0x0040; | ||
| pub const O_EXCL: c_int = 0x0080; | ||
| pub const O_NOCTTY: c_int = 0x0100; | ||
| pub const O_TRUNC: c_int = 0x0200; | ||
|
|
||
| // File status flags | ||
| pub const O_APPEND: c_int = 0x0400; | ||
| pub const O_NONBLOCK: c_int = 0x0800; | ||
| pub const O_NDELAY: c_int = O_NONBLOCK; | ||
| pub const O_SYNC: c_int = 0x1000; | ||
|
|
||
| // fcntl commands | ||
| pub const F_DUPFD: c_int = 0; | ||
| pub const F_GETFD: c_int = 1; | ||
| pub const F_SETFD: c_int = 2; | ||
| pub const F_GETFL: c_int = 3; | ||
| pub const F_SETFL: c_int = 4; | ||
| pub const F_GETLK: c_int = 5; | ||
| pub const F_SETLK: c_int = 6; | ||
| pub const F_SETLKW: c_int = 7; | ||
|
|
||
| // fcntl file descriptor flags | ||
| pub const FD_CLOEXEC: c_int = 1; | ||
|
|
||
| // flock types | ||
| pub const F_RDLCK: c_int = 0; | ||
| pub const F_WRLCK: c_int = 1; | ||
| pub const F_UNLCK: c_int = 2; | ||
|
|
||
| extern "C" { | ||
| pub fn open(pathname: *const c_char, flags: c_int, ...) -> c_int; | ||
| pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int; | ||
| pub fn creat(pathname: *const c_char, mode: mode_t) -> c_int; | ||
| pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| //! Header: `limits.h` | ||
|
|
||
| use crate::prelude::*; | ||
|
|
||
| // Character properties | ||
| pub const CHAR_BIT: c_uint = 8; | ||
| pub const CHAR_MAX: c_char = 255; // unsigned char on Hexagon | ||
| pub const CHAR_MIN: c_char = 0; | ||
| pub const SCHAR_MAX: c_schar = 127; | ||
| pub const SCHAR_MIN: c_schar = -128; | ||
| pub const UCHAR_MAX: c_uchar = 255; | ||
|
|
||
| // Integer limits (ILP32 architecture) | ||
| pub const INT_MAX: c_int = 2147483647; | ||
| pub const INT_MIN: c_int = -2147483648; | ||
| pub const UINT_MAX: c_uint = 4294967295; | ||
|
|
||
| pub const LONG_MAX: c_long = 2147483647; // 32-bit on Hexagon ILP32 | ||
| pub const LONG_MIN: c_long = -2147483648; // 32-bit on Hexagon ILP32 | ||
| pub const ULONG_MAX: c_ulong = 4294967295; // 32-bit on Hexagon ILP32 | ||
|
|
||
| pub const SHRT_MAX: c_short = 32767; | ||
| pub const SHRT_MIN: c_short = -32768; | ||
| pub const USHRT_MAX: c_ushort = 65535; | ||
|
|
||
| // POSIX limits | ||
| pub const PATH_MAX: c_int = 260; | ||
| pub const NAME_MAX: c_int = 255; | ||
| pub const IOV_MAX: c_int = 16; | ||
| pub const ARG_MAX: c_int = 4096; | ||
| pub const CHILD_MAX: c_int = 25; | ||
| pub const LINK_MAX: c_int = 8; | ||
| pub const MAX_CANON: c_int = 255; | ||
| pub const MAX_INPUT: c_int = 255; | ||
| pub const OPEN_MAX: c_int = 16; | ||
| pub const PIPE_BUF: c_int = 4096; | ||
| pub const STREAM_MAX: c_int = 8; | ||
| pub const TZNAME_MAX: c_int = 6; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| //! QuRT (Qualcomm Real-Time OS) bindings | ||
| //! | ||
| //! QuRT is Qualcomm's real-time operating system for Hexagon DSP architectures. | ||
| //! Headers available via the | ||
| //! Hexagon SDK: https://softwarecenter.qualcomm.com/catalog/item/Hexagon_SDK | ||
|
|
||
| pub(crate) mod errno; | ||
| pub(crate) mod fcntl; | ||
| pub(crate) mod limits; | ||
| pub(crate) mod pthread; | ||
| pub(crate) mod semaphore; | ||
| pub(crate) mod signal; | ||
| pub(crate) mod stdio; | ||
| pub(crate) mod stdlib; | ||
| pub(crate) mod sys; | ||
| pub(crate) mod time; | ||
| pub(crate) mod unistd; | ||
|
Comment on lines
+7
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this needs to be filled in right? Or deleted. I'd appreciate if you could at least make unistd.rs and pthread.rs in |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind adding a link to the SDK sources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, in the PR comments or in the comments of
src/new/qurt/mod.rs?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc comment - I've been doing this for
src/newto give some breadcrumbs for anyone who wants to check / update things.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, added.