1 #include <linux/kernel.h>
2 #include <linux/tapi/tapi.h>
3 #include <linux/skbuff.h>
6 #include "vmmc-coder.h"
8 struct vmmc_tapi_stream
{
9 struct vmmc_coder
*coder
;
10 struct tapi_stream stream
;
13 struct vmmc_tapi_stream
*tapi_to_vmmc_stream(struct tapi_stream
* stream
)
15 return container_of(stream
, struct vmmc_tapi_stream
, stream
);
18 struct tapi_stream
*vmmc_stream_alloc(struct tapi_device
*tdev
)
20 struct vmmc
*vmmc
= tdev_to_vmmc(tdev
);
21 struct vmmc_tapi_stream
*stream
;
22 struct vmmc_coder
*coder
;
24 coder
= vmmc_coder_get(vmmc
);
26 return ERR_PTR(-ENODEV
);
28 stream
= kzalloc(sizeof(*stream
), GFP_KERNEL
);
30 return ERR_PTR(-ENOMEM
);
32 stream
->coder
= coder
;
33 coder
->stream
= &stream
->stream
;
34 tapi_endpoint_set_data(&stream
->stream
.ep
, &coder
->module
);
36 return &stream
->stream
;
39 void vmmc_stream_free(struct tapi_device
*tdev
, struct tapi_stream
*tstream
)
41 struct vmmc
*vmmc
= tdev_to_vmmc(tdev
);
42 struct vmmc_tapi_stream
*stream
= tapi_to_vmmc_stream(tstream
);
44 stream
->coder
->stream
= NULL
;
46 vmmc_coder_put(vmmc
, stream
->coder
);
50 int vmmc_stream_start(struct tapi_device
*tdev
, struct tapi_stream
*stream
)
55 int vmmc_stream_stop(struct tapi_device
*tdev
, struct tapi_stream
*stream
)
60 int vmmc_stream_send(struct tapi_device
*tdev
, struct tapi_stream
*stream
,
63 struct vmmc
*vmmc
= tdev_to_vmmc(tdev
);
64 struct vmmc_coder
*coder
= tapi_to_vmmc_stream(stream
)->coder
;
66 vmmc_send_paket(vmmc
, coder
->id
, skb
);
70 int vmmc_stream_recv(struct vmmc_stream *stream)
72 tapi_stream_recv(&stream->coder->vmmc->tdev stream->stream, skb);
This page took 0.047174 seconds and 5 git commands to generate.