To send data using HPS, the user passes one or more of the pointers received from an HPS allocation call to one of the send-type calls along with the MSG_MAPIO flag:

          int ret, sock;
          unsigned long ptrs[15];
          struct msghdr hdr;
          struct iovec iovec[2];

          ret = send(sock, ptrs[0], 4096, MSG_MAPIO);

          hdr.msg_name = NULL;
          hdr.msg_namelen = 0;
          hdr.msg_iov = iovec;
          hdr.msg_iovlen = 2;
          iovec[0].iov_base = ptrs[0];
          iovec[0].iov_len = 4096;
          iovec[1].iov_base = ptrs[1];
          iovec[1].iov_len = 96;
          hdr.msg_control = NULL;
          hdr.msg_controllen = 0;
          hdr.msg_flags = 0;
          ret = sendmsg(sock, &hdr, MSG_MAPIO);

Notes:


[Back] [Next]