diff options
Diffstat (limited to 'samsung-ipc/modems/modem.c')
-rw-r--r-- | samsung-ipc/modems/modem.c | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/samsung-ipc/modems/modem.c b/samsung-ipc/modems/modem.c new file mode 100644 index 0000000..82a6ca7 --- /dev/null +++ b/samsung-ipc/modems/modem.c @@ -0,0 +1,194 @@ +/* + * This file is part of libsamsung-ipc. + * + * Copyright (C) 2020 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> + * + * libsamsung-ipc is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * libsamsung-ipc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <ipc.h> + +/* Set the modem into download mode */ +int modem_download_enable(struct ipc_client *client, int device_fd, int enable) +{ + return client->modem_driver_ops->download_enable(client, device_fd, + enable); +} + +/* Power on/off the modem */ +int modem_power(struct ipc_client *client, int device_fd, int power) +{ + return client->modem_driver_ops->power(client, device_fd, power); +} + +/* Power on/off the modem bus (HSIC, MIPI, etc) */ +int modem_bus_power(struct ipc_client *client, int power) +{ + return client->modem_driver_ops->bus_power(client, power); +} + +// TODO +int modem_link_control_enable(struct ipc_client *client, int device_fd, + int enable) +{ + return client->modem_driver_ops->link_control_enable(client, device_fd, + enable); +} + +//TODO +//0: HSIC is low power +//1: HSIC is back +int modem_link_control_active(struct ipc_client *client, int device_fd, + int active) +{ + return client->modem_driver_ops->link_control_active(client, device_fd, + active); +} + +//TODO: +int modem_link_connected_wait(struct ipc_client *client, int device_fd) +{ + return client->modem_driver_ops->link_connected_wait(client, device_fd); +} + +// TODO +int modem_link_get_hostwake_wait(struct ipc_client *client, int device_fd) +{ + return client->modem_driver_ops->link_get_hostwake_wait(client, + device_fd); +} + +/* Wait for the modem driver to report the ONLINE status */ +int modem_wait_status_online(__attribute__((unused)) struct ipc_client *client, + int device_fd) +{ + return client->modem_driver_ops->wait_status_online(client, device_fd); +} + +int modem_open(struct ipc_client *client, int type) +{ + return client->modem_driver_ops->open(client, type); +} + +int modem_close(struct ipc_client *client, int fd) +{ + return client->modem_driver_ops->close(client, fd); +} + +int modem_read(struct ipc_client *client, int fd, void *buffer, size_t length) +{ + return client->modem_driver_ops->read(client, fd, buffer, length); +} + +int modem_write(struct ipc_client *client, int fd, const void *buffer, + size_t length) +{ + return client->modem_driver_ops->write(client, fd, buffer, length); +} + +int modem_poll(struct ipc_client *client, int fd, struct ipc_poll_fds *fds, + struct timeval *timeout) +{ + return client->modem_driver_ops->poll(client, fd, fds, timeout); +} + +int modem_fmt_send(struct ipc_client *client, struct ipc_message *message) +{ + return client->modem_driver_ops->fmt_send(client, message); +} + +int modem_fmt_recv(struct ipc_client *client, struct ipc_message *message) +{ + return client->modem_driver_ops->fmt_recv(client, message); +} + +int modem_rfs_send(struct ipc_client *client, struct ipc_message *message) +{ + return client->modem_driver_ops->rfs_send(client, message); +} + +int modem_rfs_recv(struct ipc_client *client, struct ipc_message *message) +{ + return client->modem_driver_ops->rfs_recv(client, message); +} + +// TODO +char *modem_gprs_get_iface(struct ipc_client *client, unsigned int cid) +{ + return client->modem_driver_ops->gprs_get_iface(client, cid); +} + +// TODO +int modem_gprs_get_capabilities(struct ipc_client *client, + struct ipc_client_gprs_capabilities *capabilities) +{ + return client->modem_driver_ops->gprs_get_capabilities(client, + capabilities); +} + +// TODO: make it more generic: +// - get rid of device_fd +// - we have many <modem>_<firmware_partition>_send +// functions for partitions: +// | Function | Partition | +// | psi | PSIRAM | +// | ebl | EBL | +// | firmware | MAIN | +// | sec_start | SECPACK | +// | device specific | NV | + +// int modem_psi_send(struct ipc_client *client, int serial_fd, +// const void *psi_data, unsigned short psi_size); +// { +// /* TODO: get rid of serial_fd */ +// return client->modem_driver_ops->psi_send(client, serial_fd, psi_data, +// psi_size); +// } +// +// int modem_firmware_send(struct ipc_client *client, int device_fd, +// void *device_address, const void *firmware_data, +// size_t firmware_size) +// { +// /* TODO: get rid of device_fd */ +// return client->modem_driver_ops->firmware_send(client, device_fd, +// device_address, +// firmware_data, +// firmware_size); +// } +// +// int modem_nv_data_send(struct ipc_client *client, int device_fd, +// void *device_address) +// { +// /* TODO: get rid of device_fd */ +// return client->modem_driver_ops->firmware_send(client, device_fd, +// device_address); +// } +// +// +// int modem_psi_send(struct ipc_client *client, int serial_fd, +// const void *psi_data, unsigned short psi_size); +// { +// /* TODO: get rid of serial_fd */ +// return client->modem_driver_ops->psi_send(client, serial_fd, psi_data, +// psi_size); +// } +// + +// TODO: find a better name like block data (used for fimrware partitions) +int modem_data_send(struct ipc_client *client, int device_fd, const void *data, + size_t size, int address) +{ + return client->modem_driver_ops->data_send(client, device_fd, data, + size, address); +} |