|
| 1 | +/* |
| 2 | + * Copyright (c) 2018, Intel Corporation |
| 3 | + * All rights reserved. |
| 4 | + * |
| 5 | + * Redistribution and use in source and binary forms, with or without |
| 6 | + * modification, are permitted provided that the following conditions are met: |
| 7 | + * * Redistributions of source code must retain the above copyright |
| 8 | + * notice, this list of conditions and the following disclaimer. |
| 9 | + * * Redistributions in binary form must reproduce the above copyright |
| 10 | + * notice, this list of conditions and the following disclaimer in the |
| 11 | + * documentation and/or other materials provided with the distribution. |
| 12 | + * * Neither the name of the Intel Corporation nor the |
| 13 | + * names of its contributors may be used to endorse or promote products |
| 14 | + * derived from this software without specific prior written permission. |
| 15 | + * |
| 16 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 20 | + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 23 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 24 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 25 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 26 | + * POSSIBILITY OF SUCH DAMAGE. |
| 27 | + * |
| 28 | + * Author: Slawomir Blauciak <slawomir.blauciak@linux.intel.com> |
| 29 | + */ |
| 30 | + |
| 31 | +#include <stdint.h> |
| 32 | +#include <stddef.h> |
| 33 | +#include <sof/lock.h> |
| 34 | +#include <sof/list.h> |
| 35 | +#include <sof/stream.h> |
| 36 | +#include <sof/audio/component.h> |
| 37 | + |
| 38 | +#include "comp_mock.h" |
| 39 | + |
| 40 | +static struct comp_dev *mock_comp_new(struct sof_ipc_comp *comp) |
| 41 | +{ |
| 42 | + return calloc(1, sizeof(struct comp_dev)); |
| 43 | +} |
| 44 | + |
| 45 | +static void mock_comp_free(struct comp_dev *dev) |
| 46 | +{ |
| 47 | + free(dev); |
| 48 | +} |
| 49 | + |
| 50 | +static int mock_comp_params(struct comp_dev *dev) |
| 51 | +{ |
| 52 | + return 0; |
| 53 | +} |
| 54 | + |
| 55 | +static int mock_comp_cmd(struct comp_dev *dev, int cmd, void *data) |
| 56 | +{ |
| 57 | + return 0; |
| 58 | +} |
| 59 | + |
| 60 | +static int mock_comp_copy(struct comp_dev *dev) |
| 61 | +{ |
| 62 | + return 0; |
| 63 | +} |
| 64 | + |
| 65 | +static int mock_comp_reset(struct comp_dev *dev) |
| 66 | +{ |
| 67 | + return 0; |
| 68 | +} |
| 69 | + |
| 70 | +static int mock_comp_prepare(struct comp_dev *dev) |
| 71 | +{ |
| 72 | + return 0; |
| 73 | +} |
| 74 | + |
| 75 | +struct comp_driver comp_mock = { |
| 76 | + .type = SOF_COMP_MOCK, |
| 77 | + .ops = { |
| 78 | + .new = mock_comp_new, |
| 79 | + .free = mock_comp_free, |
| 80 | + .params = mock_comp_params, |
| 81 | + .cmd = mock_comp_cmd, |
| 82 | + .copy = mock_comp_copy, |
| 83 | + .prepare = mock_comp_prepare, |
| 84 | + .reset = mock_comp_reset, |
| 85 | + }, |
| 86 | +}; |
| 87 | + |
| 88 | +void sys_comp_mock_init(void) |
| 89 | +{ |
| 90 | + comp_register(&comp_mock); |
| 91 | +} |
0 commit comments