1
0
Fork 0

api: add cxp api support for CTRL packet

This commit is contained in:
morgan 2024-10-15 09:53:22 +08:00
parent 61b263c630
commit b2ca89149c
3 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,11 @@
use libboard_artiq::cxp_proto;
pub extern "C" fn cxp_readu32(channel: i32, addr: i32) {
// TODO: use artiq_raise like i2c?
cxp_proto::read_u32(channel as u8, addr as u32).expect("CXP transmission failed");
}
pub extern "C" fn cxp_writeu32(channel: i32, addr: i32, val: i32) {
// TODO: use artiq_raise like i2c?
cxp_proto::write_u32(channel as u8, addr as u32, val as u32).expect("CXP transmission failed");
}

View File

@ -11,6 +11,8 @@ use super::{cache,
core1::rtio_get_destination_status, core1::rtio_get_destination_status,
dma, linalg, dma, linalg,
rpc::{rpc_recv, rpc_send, rpc_send_async}}; rpc::{rpc_recv, rpc_send, rpc_send_async}};
#[cfg(has_cxp_phys)]
use crate::cxp;
use crate::{eh_artiq, i2c, rtio}; use crate::{eh_artiq, i2c, rtio};
extern "C" { extern "C" {
@ -126,6 +128,12 @@ pub fn resolve(required: &[u8]) -> Option<u32> {
#[cfg(has_drtio)] #[cfg(has_drtio)]
api!(subkernel_await_message = subkernel::await_message), api!(subkernel_await_message = subkernel::await_message),
// CoaXPress
#[cfg(has_cxp_phys)]
api!(cxp_readu32 = cxp::cxp_readu32),
#[cfg(has_cxp_phys)]
api!(cxp_writeu32 = cxp::cxp_writeu32),
// Double-precision floating-point arithmetic helper functions // Double-precision floating-point arithmetic helper functions
// RTABI chapter 4.1.2, Table 2 // RTABI chapter 4.1.2, Table 2
api!(__aeabi_dadd), api!(__aeabi_dadd),

View File

@ -35,6 +35,8 @@ pub mod rtio;
#[path = "../../../build/pl.rs"] #[path = "../../../build/pl.rs"]
pub mod pl; pub mod pl;
#[cfg(has_cxp_phys)]
pub mod cxp;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct RPCException { pub struct RPCException {