Ignore:
Timestamp:
Sep 19, 2012, 10:52:43 AM (12 years ago)
Author:
alain
Message:

Introducing support for Network controller

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/libs/stdio.c

    r204 r218  
    3333#define SYSCALL_IOC_COMPLETED   0x17
    3434#define SYSCALL_VOBJ_GET_VBASE  0x1A
     35#define SYSCALL_NIC_WRITE       0x1B
     36#define SYSCALL_NIC_READ        0x1C
     37#define SYSCALL_NIC_COMPLETED   0x1D
    3538
    3639//////////////////////////////////////////////////////////////////////////////////
     
    645648//////////////////////////////////////////////////////////////////////////////////
    646649unsigned int giet_fb_write( unsigned int        offset,
    647                             void*                       buffer,
     650                            void*               buffer,
    648651                            unsigned int        length )
    649652{
     
    667670//////////////////////////////////////////////////////////////////////////////////
    668671unsigned int giet_fb_read( unsigned int         offset,
    669                            void*                        buffer,
     672                           void*                buffer,
    670673                           unsigned int         length )
    671674{
     
    685688{
    686689    return sys_call(SYSCALL_FB_COMPLETED,
     690                    0, 0, 0, 0);
     691}
     692
     693//////////////////////////////////////////////////////////////////////////////////
     694// giet_nic_write()
     695//////////////////////////////////////////////////////////////////////////////////
     696// This non-blocking function use the DMA coprocessor to transfer data from the
     697// NIC device to an user buffer.
     698// - offset : offset (in bytes) in the NIC
     699// - buffer : base address of the memory buffer
     700// - length : number of bytes to be transfered
     701// The transfer completion is signaled by an IRQ, and must be tested by the
     702// nic_completed() function.
     703// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
     704//////////////////////////////////////////////////////////////////////////////////
     705
     706unsigned int giet_nic_write( unsigned int       offset,
     707                             void*              buffer,
     708                             unsigned int       length )
     709{
     710    return sys_call(SYSCALL_NIC_WRITE,
     711            offset,
     712            (unsigned int)buffer,
     713            length,
     714            0);
     715}
     716
     717//////////////////////////////////////////////////////////////////////////////////
     718// giet_nic_read()
     719//////////////////////////////////////////////////////////////////////////////////
     720// This non-blocking function use the DMA coprocessor to transfer data from the
     721// NIC device to an user buffer.
     722// - offset : offset (in bytes) in the NIC
     723// - buffer : base address of the memory buffer
     724// - length : number of bytes to be transfered
     725// The transfer completion is signaled by an IRQ, and must be tested by the
     726// nic_completed() function.
     727// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
     728//////////////////////////////////////////////////////////////////////////////////
     729
     730unsigned int giet_nic_read( unsigned int        offset,
     731                            void*                   buffer,
     732                            unsigned int        length )
     733{
     734    return sys_call(SYSCALL_NIC_READ,
     735            offset,
     736            (unsigned int)buffer,
     737            length,
     738            0);
     739}
     740
     741//////////////////////////////////////////////////////////////////////////////////
     742// giet_nic_completed()
     743//////////////////////////////////////////////////////////////////////////////////
     744// This blocking function returns when the transfer is completed.
     745// - Returns 0 if success, > 0 if error.
     746//////////////////////////////////////////////////////////////////////////////////
     747unsigned int giet_nic_completed()
     748{
     749    return sys_call(SYSCALL_NIC_COMPLETED,
    687750                    0, 0, 0, 0);
    688751}
Note: See TracChangeset for help on using the changeset viewer.