Skip to content

Commit

Permalink
uapi: adding missing systypes
Browse files Browse the repository at this point in the history
fix snake case to caml case
  • Loading branch information
pthierry-ledger committed Dec 11, 2024
1 parent 394604f commit bb6f40c
Show file tree
Hide file tree
Showing 3 changed files with 392 additions and 76 deletions.
44 changes: 24 additions & 20 deletions uapi/src/ffi_c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use crate::systypes::*;

#[no_mangle]
pub extern "C" fn __sys_get_process_handle(process: ProcessLabel) -> Status {
pub extern "C" fn __sys_get_process_handle(process: TaskLabel) -> Status {
crate::syscall::get_process_handle(process)
}

Expand Down Expand Up @@ -34,37 +34,41 @@ pub extern "C" fn __sys_sleep(duration_ms: SleepDuration, mode: SleepMode) -> St
}

#[no_mangle]
pub extern "C" fn __sys_start(process: ProcessLabel) -> Status {
pub extern "C" fn __sys_start(process: TaskLabel) -> Status {
crate::syscall::start(process)
}

#[no_mangle]
pub extern "C" fn __sys_map_dev(dev: devh_t) -> Status {
crate::syscall::map_dev(dev as devh_t)
pub extern "C" fn __sys_map_dev(dev: DeviceHandle) -> Status {
crate::syscall::map_dev(dev as DeviceHandle)
}

#[no_mangle]
pub extern "C" fn __sys_map_shm(shm: shmh_t) -> Status {
crate::syscall::map_shm(shm as shmh_t)
pub extern "C" fn __sys_map_shm(shm: ShmHandle) -> Status {
crate::syscall::map_shm(shm as ShmHandle)
}

#[no_mangle]
pub extern "C" fn __sys_unmap_dev(dev: devh_t) -> Status {
crate::syscall::unmap_dev(dev as devh_t)
pub extern "C" fn __sys_unmap_dev(dev: DeviceHandle) -> Status {
crate::syscall::unmap_dev(dev as DeviceHandle)
}

#[no_mangle]
pub extern "C" fn __sys_unmap_shm(shm: shmh_t) -> Status {
crate::syscall::unmap_shm(shm as shmh_t)
pub extern "C" fn __sys_unmap_shm(shm: ShmHandle) -> Status {
crate::syscall::unmap_shm(shm as ShmHandle)
}

#[no_mangle]
pub extern "C" fn __sys_shm_set_credential(shm: shmh_t, id: taskh_t, shm_perm: u32) -> Status {
pub extern "C" fn __sys_shm_set_credential(
shm: ShmHandle,
id: TaskHandle,
shm_perm: u32,
) -> Status {
crate::syscall::shm_set_credential(shm, id, shm_perm)
}

#[no_mangle]
pub extern "C" fn __sys_send_ipc(target: taskh_t, length: u8) -> Status {
pub extern "C" fn __sys_send_ipc(target: TaskHandle, length: u8) -> Status {
crate::syscall::send_ipc(target, length)
}

Expand Down Expand Up @@ -154,41 +158,41 @@ pub extern "C" fn __sys_pm_set_clock(clk_reg: u32, clkmsk: u32, val: u32) -> Sta
}

#[no_mangle]
pub extern "C" fn __sys_dma_start_stream(dmah: dmah_t) -> Status {
pub extern "C" fn __sys_dma_start_stream(dmah: StreamHandle) -> Status {
crate::syscall::dma_start_stream(dmah)
}

#[no_mangle]
pub extern "C" fn __sys_dma_suspend_stream(dmah: dmah_t) -> Status {
pub extern "C" fn __sys_dma_suspend_stream(dmah: StreamHandle) -> Status {
crate::syscall::dma_suspend_stream(dmah)
}

#[no_mangle]
pub extern "C" fn __sys_dma_get_stream_status(dmah: dmah_t) -> Status {
pub extern "C" fn __sys_dma_get_stream_status(dmah: StreamHandle) -> Status {
crate::syscall::dma_get_stream_status(dmah)
}

#[no_mangle]
pub extern "C" fn __sys_shm_get_infos(shm: shmh_t) -> Status {
pub extern "C" fn __sys_shm_get_infos(shm: ShmHandle) -> Status {
crate::syscall::shm_get_infos(shm)
}

#[no_mangle]
pub extern "C" fn __sys_dma_assign_stream(dmah: dmah_t) -> Status {
pub extern "C" fn __sys_dma_assign_stream(dmah: StreamHandle) -> Status {
crate::syscall::dma_assign_stream(dmah)
}

#[no_mangle]
pub extern "C" fn __sys_dma_unassign_stream(dmah: dmah_t) -> Status {
pub extern "C" fn __sys_dma_unassign_stream(dmah: StreamHandle) -> Status {
crate::syscall::dma_unassign_stream(dmah)
}

#[no_mangle]
pub extern "C" fn __sys_dma_get_stream_info(dmah: dmah_t) -> Status {
pub extern "C" fn __sys_dma_get_stream_info(dmah: StreamHandle) -> Status {
crate::syscall::dma_get_stream_info(dmah)
}

#[no_mangle]
pub extern "C" fn __sys_dma_resume_stream(dmah: dmah_t) -> Status {
pub extern "C" fn __sys_dma_resume_stream(dmah: StreamHandle) -> Status {
crate::syscall::dma_resume_stream(dmah)
}
32 changes: 16 additions & 16 deletions uapi/src/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn exit(status: i32) -> Status {
/// ```
///
#[inline(always)]
pub fn get_process_handle(process: ProcessLabel) -> Status {
pub fn get_process_handle(process: TaskLabel) -> Status {
syscall!(Syscall::GetProcessHandle, process).into()
}

Expand Down Expand Up @@ -214,7 +214,7 @@ pub fn sleep(duration_ms: SleepDuration, mode: SleepMode) -> Status {
/// ```
///
#[inline(always)]
pub fn start(process: ProcessLabel) -> Status {
pub fn start(process: TaskLabel) -> Status {
syscall!(Syscall::Start, process).into()
}

Expand Down Expand Up @@ -251,7 +251,7 @@ pub fn start(process: ProcessLabel) -> Status {
/// ```
///
#[inline(always)]
pub fn map_dev(dev: devh_t) -> Status {
pub fn map_dev(dev: DeviceHandle) -> Status {
syscall!(Syscall::MapDev, dev).into()
}

Expand Down Expand Up @@ -289,7 +289,7 @@ pub fn map_dev(dev: devh_t) -> Status {
/// ```
///
#[inline(always)]
pub fn map_shm(shm: shmh_t) -> Status {
pub fn map_shm(shm: ShmHandle) -> Status {
syscall!(Syscall::MapShm, shm).into()
}

Expand Down Expand Up @@ -321,7 +321,7 @@ pub fn map_shm(shm: shmh_t) -> Status {
/// ```
///
#[inline(always)]
pub fn unmap_dev(dev: devh_t) -> Status {
pub fn unmap_dev(dev: DeviceHandle) -> Status {
syscall!(Syscall::UnmapDev, dev).into()
}

Expand Down Expand Up @@ -352,7 +352,7 @@ pub fn unmap_dev(dev: devh_t) -> Status {
/// ```
///
#[inline(always)]
pub fn unmap_shm(shm: shmh_t) -> Status {
pub fn unmap_shm(shm: ShmHandle) -> Status {
syscall!(Syscall::UnmapShm, shm).into()
}

Expand Down Expand Up @@ -411,7 +411,7 @@ pub fn unmap_shm(shm: shmh_t) -> Status {
/// [`get_shm_handle`], [`map_shm`], [`unmap_shm`] and [`shm_get_infos`].
///
#[inline(always)]
pub fn shm_set_credential(shm: shmh_t, id: taskh_t, shm_perm: u32) -> Status {
pub fn shm_set_credential(shm: ShmHandle, id: TaskHandle, shm_perm: u32) -> Status {
syscall!(Syscall::SHMSetCredential, shm, id, shm_perm).into()
}

Expand Down Expand Up @@ -453,7 +453,7 @@ pub fn shm_set_credential(shm: shmh_t, id: taskh_t, shm_perm: u32) -> Status {
/// ```
///
#[inline(always)]
pub fn send_ipc(target: taskh_t, length: u8) -> Status {
pub fn send_ipc(target: TaskHandle, length: u8) -> Status {
syscall!(Syscall::SendIPC, target, length as u32).into()
}

Expand Down Expand Up @@ -797,47 +797,47 @@ pub fn pm_set_clock(clk_reg: u32, clkmsk: u32, val: u32) -> Status {
///
/// TODO: with complete DMA support
#[inline(always)]
pub fn dma_start_stream(dmah: dmah_t) -> Status {
pub fn dma_start_stream(dmah: StreamHandle) -> Status {
syscall!(Syscall::DmaStartStream, dmah).into()
}

/// suspend a DMA stream
///
/// TODO: with complete DMA support
#[inline(always)]
pub fn dma_suspend_stream(dmah: dmah_t) -> Status {
pub fn dma_suspend_stream(dmah: StreamHandle) -> Status {
syscall!(Syscall::DmaSuspendStream, dmah).into()
}

/// get the status of a given DMA stream
///
/// TODO: with complete DMA support
#[inline(always)]
pub fn dma_get_stream_status(dmah: dmah_t) -> Status {
pub fn dma_get_stream_status(dmah: StreamHandle) -> Status {
syscall!(Syscall::DmaGetStreamStatus, dmah).into()
}

/// get the static information of a given DMA stream
///
/// TODO: with complete DMA support
#[inline(always)]
pub fn shm_get_infos(shm: shmh_t) -> Status {
pub fn shm_get_infos(shm: ShmHandle) -> Status {
syscall!(Syscall::ShmGetInfos, shm).into()
}

/// assign a DMA stream to its corresponding hardware channel
///
/// TODO: with complete DMA support
#[inline(always)]
pub fn dma_assign_stream(dmah: dmah_t) -> Status {
pub fn dma_assign_stream(dmah: StreamHandle) -> Status {
syscall!(Syscall::DmaAssignStream, dmah).into()
}

/// unassign a DMA stream from its corresponding hardware channel
///
/// TODO: with complete DMA support
#[inline(always)]
pub fn dma_unassign_stream(dmah: dmah_t) -> Status {
pub fn dma_unassign_stream(dmah: StreamHandle) -> Status {
syscall!(Syscall::DmaUnassignStream, dmah).into()
}

Expand All @@ -846,15 +846,15 @@ pub fn dma_unassign_stream(dmah: dmah_t) -> Status {
///
/// TODO: with complete DMA support
#[inline(always)]
pub fn dma_get_stream_info(dmah: dmah_t) -> Status {
pub fn dma_get_stream_info(dmah: StreamHandle) -> Status {
syscall!(Syscall::DmaGetStreamInfo, dmah).into()
}

/// resume a DMA stream
///
/// TODO: with complete DMA support
#[inline(always)]
pub fn dma_resume_stream(dmah: dmah_t) -> Status {
pub fn dma_resume_stream(dmah: StreamHandle) -> Status {
syscall!(Syscall::DmaResumeStream, dmah).into()
}

Expand Down
Loading

0 comments on commit bb6f40c

Please sign in to comment.