Changeset 5c65e61 in mainline


Ignore:
Timestamp:
2013-12-31T20:55:35Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8a84484
Parents:
67472b9b
Message:

libc,libdrv: Move char dev iface to libdrv

Location:
uspace
Files:
1 deleted
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/sportdmp/Makefile

    r67472b9b r5c65e61  
    2828
    2929USPACE_PREFIX = ../..
    30 #LIBS =
    31 #EXTRA_CFLAGS =
     30LIBS = $(LIBDRV_PREFIX)/libdrv.a
     31EXTRA_CFLAGS = -I$(LIBDRV_PREFIX)/include
    3232BINARY = sportdmp
    3333
  • uspace/app/sportdmp/sportdmp.c

    r67472b9b r5c65e61  
    2727 */
    2828
    29 #include <device/char_dev.h>
     29#include <char_dev_iface.h>
    3030#include <errno.h>
    3131#include <ipc/serial_ctl.h>
  • uspace/app/tester/Makefile

    r67472b9b r5c65e61  
    2929
    3030USPACE_PREFIX = ../..
    31 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
    32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBSOFTFLOAT_PREFIX)
     31LIBS = \
     32        $(LIBBLOCK_PREFIX)/libblock.a \
     33        $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a \
     34        $(LIBDRV_PREFIX)/libdrv.a
     35
     36EXTRA_CFLAGS = \
     37        -I$(LIBBLOCK_PREFIX) \
     38        -I$(LIBSOFTFLOAT_PREFIX) \
     39        -I$(LIBDRV_PREFIX)/include
     40
    3341BINARY = tester
    3442
  • uspace/app/tester/hw/misc/virtchar1.c

    r67472b9b r5c65e61  
    4040#include <sys/types.h>
    4141#include <async.h>
    42 #include <device/char_dev.h>
     42#include <char_dev_iface.h>
    4343#include <str.h>
    4444#include <vfs/vfs.h>
  • uspace/app/tester/hw/serial/serial1.c

    r67472b9b r5c65e61  
    4343#include <ipc/services.h>
    4444#include <loc.h>
    45 #include <device/char_dev.h>
     45#include <char_dev_iface.h>
    4646#include <str.h>
    4747#include <ipc/serial_ctl.h>
  • uspace/lib/c/Makefile

    r67472b9b r5c65e61  
    6969        generic/device/hw_res_parsed.c \
    7070        generic/device/pio_window.c \
    71         generic/device/char_dev.c \
    7271        generic/device/clock_dev.c \
    7372        generic/dhcp.c \
  • uspace/lib/drv/generic/remote_char_dev.c

    r67472b9b r5c65e61  
    3636#include <errno.h>
    3737#include <macros.h>
    38 #include <device/char_dev.h>
    3938
    4039#include "ops/char_dev.h"
     40#include "char_dev_iface.h"
    4141#include "ddf/driver.h"
    4242
    4343#define MAX_CHAR_RW_COUNT 256
     44
     45/** Read to or write from device.
     46 *
     47 * Helper function to read to or write from a device
     48 * using its character interface.
     49 *
     50 * @param sess Session to the device.
     51 * @param buf  Buffer for the data read from or written to the device.
     52 * @param size Maximum size of data (in bytes) to be read or written.
     53 * @param read Read from the device if true, write to it otherwise.
     54 *
     55 * @return Non-negative number of bytes actually read from or
     56 *         written to the device on success, negative error number
     57 *         otherwise.
     58 *
     59 */
     60static ssize_t char_dev_rw(async_sess_t *sess, void *buf, size_t size, bool read)
     61{
     62        ipc_call_t answer;
     63        aid_t req;
     64        int ret;
     65       
     66        async_exch_t *exch = async_exchange_begin(sess);
     67       
     68        if (read) {
     69                req = async_send_1(exch, DEV_IFACE_ID(CHAR_DEV_IFACE),
     70                    CHAR_DEV_READ, &answer);
     71                ret = async_data_read_start(exch, buf, size);
     72        } else {
     73                req = async_send_1(exch, DEV_IFACE_ID(CHAR_DEV_IFACE),
     74                    CHAR_DEV_WRITE, &answer);
     75                ret = async_data_write_start(exch, buf, size);
     76        }
     77       
     78        async_exchange_end(exch);
     79       
     80        sysarg_t rc;
     81        if (ret != EOK) {
     82                async_wait_for(req, &rc);
     83                if (rc == EOK)
     84                        return (ssize_t) ret;
     85               
     86                return (ssize_t) rc;
     87        }
     88       
     89        async_wait_for(req, &rc);
     90       
     91        ret = (int) rc;
     92        if (ret != EOK)
     93                return (ssize_t) ret;
     94       
     95        return (ssize_t) IPC_GET_ARG1(answer);
     96}
     97
     98/** Read from character device.
     99 *
     100 * @param sess Session to the device.
     101 * @param buf  Output buffer for the data read from the device.
     102 * @param size Maximum size (in bytes) of the data to be read.
     103 *
     104 * @return Non-negative number of bytes actually read from the
     105 *         device on success, negative error number otherwise.
     106 *
     107 */
     108ssize_t char_dev_read(async_sess_t *sess, void *buf, size_t size)
     109{
     110        return char_dev_rw(sess, buf, size, true);
     111}
     112
     113/** Write to character device.
     114 *
     115 * @param sess Session to the device.
     116 * @param buf  Input buffer containg the data to be written to the
     117 *             device.
     118 * @param size Maximum size (in bytes) of the data to be written.
     119 *
     120 * @return Non-negative number of bytes actually written to the
     121 *         device on success, negative error number otherwise.
     122 *
     123 */
     124ssize_t char_dev_write(async_sess_t *sess, void *buf, size_t size)
     125{
     126        return char_dev_rw(sess, buf, size, false);
     127}
    44128
    45129static void remote_char_read(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
  • uspace/lib/drv/include/char_dev_iface.h

    r67472b9b r5c65e61  
    3333 */
    3434
    35 #ifndef LIBC_DEVICE_CHAR_DEV_H_
    36 #define LIBC_DEVICE_CHAR_DEV_H_
     35#ifndef LIBDRV_CHAR_DEV_IFACE_H_
     36#define LIBDRV_CHAR_DEV_IFACE_H_
    3737
    3838#include <async.h>
  • uspace/srv/hid/isdv4_tablet/Makefile

    r67472b9b r5c65e61  
    2828
    2929USPACE_PREFIX = ../../..
    30 #LIBS =
    31 #EXTRA_CFLAGS =
     30LIBS = $(LIBDRV_PREFIX)/libdrv.a
     31EXTRA_CFLAGS = -I$(LIBDRV_PREFIX)/include
    3232BINARY = isdv4_tablet
    3333
  • uspace/srv/hid/isdv4_tablet/isdv4.c

    r67472b9b r5c65e61  
    2727 */
    2828
    29 #include <device/char_dev.h>
     29#include <char_dev_iface.h>
    3030#include <errno.h>
    3131#include <stdlib.h>
  • uspace/srv/hid/isdv4_tablet/main.c

    r67472b9b r5c65e61  
    2727 */
    2828
    29 #include <device/char_dev.h>
     29#include <char_dev_iface.h>
    3030#include <errno.h>
    3131#include <ipc/serial_ctl.h>
  • uspace/srv/net/slip/Makefile

    r67472b9b r5c65e61  
    2929USPACE_PREFIX = ../../..
    3030BINARY = slip
    31 
     31LIBS = $(LIBDRV_PREFIX)/libdrv.a
     32EXTRA_CFLAGS = -I$(LIBDRV_PREFIX)/include
    3233SOURCES = \
    3334        slip.c
  • uspace/srv/net/slip/slip.c

    r67472b9b r5c65e61  
    4040#include <inet/addr.h>
    4141#include <inet/iplink_srv.h>
    42 #include <device/char_dev.h>
     42#include <char_dev_iface.h>
    4343#include <io/log.h>
    4444#include <errno.h>
Note: See TracChangeset for help on using the changeset viewer.