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
16 #include <platform_support.h> /* NULL */
17 #include <assert_support.h>
18 #include "tag_local.h"
21 * @brief Creates the tag description from the given parameters.
22 * @param[in] num_captures
25 * @param[out] tag_descr
28 sh_css_create_tag_descr(int num_captures
,
32 struct sh_css_tag_descr
*tag_descr
)
34 assert(tag_descr
!= NULL
);
36 tag_descr
->num_captures
= num_captures
;
37 tag_descr
->skip
= skip
;
38 tag_descr
->offset
= offset
;
39 tag_descr
->exp_id
= exp_id
;
43 * @brief Encodes the members of tag description into a 32-bit value.
44 * @param[in] tag Pointer to the tag description
45 * @return (unsigned int) Encoded 32-bit tag-info
48 sh_css_encode_tag_descr(struct sh_css_tag_descr
*tag
)
51 unsigned int num_captures_sign
;
54 unsigned int offset_sign
;
56 unsigned int encoded_tag
;
60 if (tag
->num_captures
< 0) {
61 num_captures
= -tag
->num_captures
;
62 num_captures_sign
= 1;
64 num_captures
= tag
->num_captures
;
65 num_captures_sign
= 0;
68 if (tag
->offset
< 0) {
69 offset
= -tag
->offset
;
79 /* we encode either an exp_id or capture data */
80 assert((num_captures
== 0) && (skip
== 0) && (offset
== 0));
82 encoded_tag
= TAG_EXP
| (exp_id
& 0xFF) << TAG_EXP_ID_SHIFT
;
87 | ((num_captures_sign
& 0x00000001) << TAG_NUM_CAPTURES_SIGN_SHIFT
)
88 | ((offset_sign
& 0x00000001) << TAG_OFFSET_SIGN_SHIFT
)
89 | ((num_captures
& 0x000000FF) << TAG_NUM_CAPTURES_SHIFT
)
90 | ((skip
& 0x000000FF) << TAG_OFFSET_SHIFT
)
91 | ((offset
& 0x000000FF) << TAG_SKIP_SHIFT
);