]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/eventq/src/eventq.c
2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #include "ia_css_types.h"
16 #include "assert_support.h"
17 #include "ia_css_queue.h" /* sp2host_dequeue_irq_event() */
18 #include "ia_css_eventq.h"
19 #include "ia_css_event.h" /* ia_css_event_encode()
22 #include "platform_support.h" /* hrt_sleep() */
24 int ia_css_eventq_recv(
25 ia_css_queue_t
*eventq_handle
,
31 /* dequeue the IRQ event */
32 error
= ia_css_queue_dequeue(eventq_handle
, &sp_event
);
34 /* check whether the IRQ event is available or not */
36 ia_css_event_decode(sp_event
, payload
);
41 * @brief The Host sends the event to the SP.
42 * Refer to "sh_css_sp.h" for details.
44 int ia_css_eventq_send(
45 ia_css_queue_t
*eventq_handle
,
47 uint8_t evt_payload_0
,
48 uint8_t evt_payload_1
,
49 uint8_t evt_payload_2
)
56 * Encode the queue type, the thread ID and
57 * the queue ID into the event.
60 tmp
[1] = evt_payload_0
;
61 tmp
[2] = evt_payload_1
;
62 tmp
[3] = evt_payload_2
;
63 ia_css_event_encode(tmp
, 4, &sw_event
);
65 /* queue the software event (busy-waiting) */
67 error
= ia_css_queue_enqueue(eventq_handle
, sw_event
);
68 if (ENOBUFS
!= error
) {
69 /* We were able to successfully send the event
70 or had a real failure. return the status*/
73 /* Wait for the queue to be not full and try again*/