From d57e8d3e86752f28ab51b75d4a30809463a2c9b7 Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Wed, 21 Oct 2020 14:41:04 +0900 Subject: video_in_hal branch --- LICENSE | 177 +++++++++++++++ Makefile | 61 ++++++ README.md | 3 + hal_api/video_in_hal.h | 567 +++++++++++++++++++++++++++++++++++++++++++++++++ src/video_in_hal.c | 50 +++++ 5 files changed, 858 insertions(+) create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 hal_api/video_in_hal.h create mode 100644 src/video_in_hal.c diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..f433b1a5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..25ebaabd --- /dev/null +++ b/Makefile @@ -0,0 +1,61 @@ +# +# @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +######### installed program/file ################ +TARGET = libvideo_in_hal.so + +HEADER = hal_api/video_in_hal.h + +######### include paths/files ################### +CFLAGS += -I./hal_api/ +CFLAGS += -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_types_obsoluted.h + +######### compile options ####################### +CFLAGS += -Wall -fPIC + +######### link options ########################## +LDFLAGS += -shared +LDFLAGS += -Wl,--no-as-needed +LDFLAGS += -Wl,--no-undefined +LDFLAGS += -Wl,--warn-unresolved-symbols + +######### linked library ######################## + +######### source files ########################## +VPATH := ./src/ + +OBJS := video_in_hal.o + +######### make targets ########################## +all: $(TARGET) + @echo $@ done. + +$(TARGET): $(OBJS) + $(CC) $(LDFLAGS) -Wl,-rpath=$(RPATH) $(OBJS) $(LIBS) -o $(TARGET) + @echo $@ done. + +######### make cleans ########################### +GCNO_FILES := $(filter %.gcno,$(OBJS:%.o=%.gcno)) + +clean: + rm -f $(OBJS) $(TARGET) $(GCNO_FILES) + @echo $@ done. + +######### make installs ######################### +install: + install -d -m 0755 $(DESTDIR)/usr/lib + install -m 0755 $(TARGET) $(DESTDIR)/usr/lib + @echo $@ done. diff --git a/README.md b/README.md new file mode 100644 index 00000000..bb50e726 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +video_in_hal library +================== +video_in HAL implementation library for AGL Reference Board. diff --git a/hal_api/video_in_hal.h b/hal_api/video_in_hal.h new file mode 100644 index 00000000..20b45a04 --- /dev/null +++ b/hal_api/video_in_hal.h @@ -0,0 +1,567 @@ +/* + * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HAL_API_VIDEO_IN_HAL_H_ +#define HAL_API_VIDEO_IN_HAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file video_in_hal.h + * @brief API definition of the function to control video + */ + +/** @addtogroup graphics_service + * @{ + */ +/** @addtogroup video_in_hal + * @ingroup graphics_service + * @{ + */ + + +/* Monitor state */ +#define VIH_DISP_MONITOR_ON (0) //!< \~english Monitor on +#define VIH_DISP_MONITOR_OFF (1) //!< \~english Monitor Off + +/* Illumination */ +#define VIH_DISP_ILLUMI_INIT (0) //!< \~english Not configured +#define VIH_DISP_ILLUMI_DAY (1) //!< \~english Day screen +#define VIH_DISP_ILLUMI_NIGHT (2) //!< \~english Night screen +#define VIH_DISP_ILLUMI_FOURCE_DAY (3) //!< \~english Force day screen +#define VIH_DISP_ILLUMI_FOURCE_NIGHT (4) //!< \~english Force night screen + +/* Auto dimmer */ +#define VIH_DISP_AUTO_DIMMER_OFF (0) //!< \~english Auto dimmer off +#define VIH_DISP_AUTO_DIMMER_ON (1) //!< \~english Auto dimmer on + +/* MUTE */ +#define VIH_DISP_MUTE_OFF (0) //!< \~english Mute off +#define VIH_DISP_MUTE_ON (1) //!< \~english Mute on + +/* Back light */ +#define VIH_DISP_BACKLIGHT_OFF (0) //!< \~english Back light off +#define VIH_DISP_BACKLIGHT_ON (1) //!< \~english Back light on + +/* Type of video source */ +#define VIH_VIDEO_SOURCE_R_CAMERA (0x00) //!< \~english Rear video camera +#define VIH_VIDEO_SOURCE_F_CAMERA (0x01) //!< \~english Front video camera +#define VIH_VIDEO_SOURCE_S_CAMERA (0x02) //!< \~english Side video camera +#define VIH_VIDEO_SOURCE_STOP (0x03) //!< \~english Stop the video +#define VIH_VIDEO_SOURCE_DVD (0x04) //!< \~english DVD video +#define VIH_VIDEO_SOURCE_BD (0x05) //!< \~english BD video +#define VIH_VIDEO_SOURCE_DTV (0x06) //!< \~english DTV(Built-in) +#define VIH_VIDEO_SOURCE_EXT_DTV (0x07) //!< \~english DTV(External) +#define VIH_VIDEO_SOURCE_SD_VIDEO (0x08) //!< \~english SD video +#define VIH_VIDEO_SOURCE_VTR (0x09) //!< \~english VTR(Built-in) +#define VIH_VIDEO_SOURCE_VTR2 (0x0A) //!< \~english VTR2(Built-in) +#define VIH_VIDEO_SOURCE_EXT_VTR (0x0B) //!< \~english VTR(External) +#define VIH_VIDEO_SOURCE_EXT_NAVI (0x0C) //!< \~english NAVI(External) +#define VIH_VIDEO_SOURCE_EXT (0x0D) //!< \~english Extension box +#define VIH_VIDEO_SOURCE__CWORD57__VIDEO (0x0E) //!< \~english _CWORD57_(Video) +#define VIH_VIDEO_SOURCE__CWORD57__OUT (0x0F) //!< \~english _CWORD57_(Out) +#define VIH_VIDEO_SOURCE__CWORD57__NAVI (0x10) //!< \~english _CWORD57_(Navi) +#define VIH_VIDEO_SOURCE_MIRRORLINK (0x11) //!< \~english Mirror link +#define VIH_VIDEO_SOURCE_USB_VIDEO (0x12) //!< \~english USB video +#define VIH_VIDEO_SOURCE_MIRACAST (0x16) //!< \~english Miracast +#define VIH_VIDEO_SOURCE__CWORD27_ (0x17) //!< \~english _CWORD111_ +#define VIH_VIDEO_SOURCE_SD_VIDEO_CPRM (0x18) //!< \~english SD source(CPRM) +#define VIH_VIDEO_SOURCE_SD_VIDEO_AVCHD (0x19) //!< \~english SD source(AVCHD) +#define VIH_VIDEO_SOURCE_DIAG_CAMERA (0x1A) //!< \~english Camera diagnosis +#define VIH_VIDEO_SOURCE_BLANK (0xFE) //!< \~english Blank + +/* Type of TV system */ +#define VIH_VIDEO_TVTYPE_NONE (0) //!< \~english Not configured +#define VIH_VIDEO_TVTYPE_NTSC (1) //!< \~english NTSC +#define VIH_VIDEO_TVTYPE_PAL (2) //!< \~english PAL +#define VIH_VIDEO_TVTYPE_SECAM (3) //!< \~english SECAM +#define VIH_VIDEO_TVTYPE_AUTO (255) //!< \~english Auto + +/* de-interlace */ +#define VIH_VIDEO_INTERLACE_DEFAULT (0) //!< \~english Interlaced(Default) +#define VIH_VIDEO_INTERLACE_REPLICATE (1) //!< \~english Interlaced(Reprica) +#define VIH_VIDEO_INTERLACE_WEAVE (2) //!< \~english Interlaced(Weave) +#define VIH_VIDEO_INTERLACE_BOB (3) //!< \~english Interlaced(Bob) +#define VIH_VIDEO_INTERLACE_AUTO (4) //!< \~english Interlaces(Auto) +#define VIH_VIDEO_INTERLACE_LINE (5) //!< \~english Interlaces(Line) + +/* Aspect */ +#define VIH_VIDEO_ASPECT_NORMAL (0) //!< \~english Normal +#define VIH_VIDEO_ASPECT_WIDE (1) //!< \~english Wide +#define VIH_VIDEO_ASPECT_FULL (2) //!< \~english Full +#define VIH_VIDEO_ASPECT_ZOOM (3) //!< \~english Zoom + +/* Aspect Ratio */ +#define VIH_VIDEO_ASPECT_RATIO_DEFAULT (0) //!< \~english Default +#define VIH_VIDEO_ASPECT_RATIO_4_3 (1) //!< \~english 4:3 +#define VIH_VIDEO_ASPECT_RATIO_16_9 (2) //!< \~english 16:9 +#define VIH_VIDEO_ASPECT_RATIO_4_3_LB (3) //!< \~english 4:3(Letter box) + +/* Enable or disable */ +#define VIH_ENABLE (1) //!< \~english Enable +#define VIH_DISABLE (0) //!< \~english Disable + +/* Send information: Control module */ +#define VIH_DISP_SEQ_CTRL 0x0003 //!< \~english Sequence control +#define VIH_DISP_VCAP1_CTRL 0x0005 //!< \~english Video capture1 control +#define VIH_DISP_VCAP2_CTRL 0x0006 //!< \~english Video capture2 control + +/* Message ID: Put or delete diagnosis code */ +#define VIH_DISP_MAIN_IND_PUTDIAG (0x5200) //!< \~english Put diagnosis code +#define VIH_DISP_MAIN_IND_DELDIAG (0x5201) //!< \~english Delete diagnosis code + +/** + * \~english Event ID + */ +typedef enum TagVideoInHalEventID { + VIH_EVENT_ID_SOURCE, //!< \~english Display source change + VIH_EVENT_ID_QUALITY, //!< \~english Set quality(display) + VIH_EVENT_ID_VIDEOQUALITY, //!< \~english Set quality(video) + VIH_EVENT_ID_ASPECT, //!< \~english Set aspect + VIH_EVENT_ID_MONITOR, //!< \~english Set monitor(display) + VIH_EVENT_ID_VIDEOVISIBLE, //!< \~english Set video visible(video) + VIH_EVENT_ID_MUTE, //!< \~english Set mute + VIH_EVENT_ID_BACKLIGHT, //!< \~english Set backlight + VIH_EVENT_ID_NUM_MAX +} VIH_EVENTID; + +/** + * \~english Control ID + */ +typedef enum TagVideoInHalControlID { + VIH_CONTROL_ID_SOURCE, //!< \~english Display source change + VIH_CONTROL_ID_QUALITY, //!< \~english Set quality(display) + VIH_CONTROL_ID_VIDEOQUALITY, //!< \~english Set quality(video) + VIH_CONTROL_ID_ASPECT, //!< \~english Set aspect + VIH_CONTROL_ID_MONITOR, //!< \~english Set monitor(display) + VIH_CONTROL_ID_VIDEOVISIBLE, //!< \~english Set video visible(video) + VIH_CONTROL_ID_START_CAPTURE, //!< \~english Start capture + VIH_CONTROL_ID_STOP_CAPTURE, //!< \~english Stop capture + VIH_CONTROL_ID_TVTYPE, //!< \~english Set TV type + VIH_CONTROL_ID_DEINTERLACE, //!< \~english Set de-interlace + VIH_CONTROL_ID_VMUTE, //!< \~english Set mute + VIH_CONTROL_ID_BACKLIGHT, //!< \~english Set backlight + VIH_CONTROL_ID_NUM_MAX +} VIH_CONTROLID; + +/** + * \~english Type of video device's return value + */ +typedef enum TagVideoInHalRet { + VIH_RET_SUCCESS, //!< \~english OK + VIH_RET_INVALID_PARAMETER, //!< \~english Invalid parameter + VIH_RET_INTERNAL_ERROR, //!< \~english Internal error + VIH_RET_NUM_MAX +} VIH_RET; + +/** + * \~english context kind + */ +typedef enum TagVideoInHalContext { + VIH_CONTEXT_DISP = 0, //!< \~english Display + VIH_CONTEXT_VIDEO, //!< \~english Video + VIH_CONTEXT_NUM_MAX +} VIH_CONTEXT; + +/** + * \~english Display ID + */ +typedef enum TagVideoInHalDispIdx { + VIH_DISP_IDX_MONITOR0, //!< \~english Monitor0 (Front monitor) + VIH_DISP_IDX_MONITOR1, //!< \~english Monitor1 (Rear monitor) + VIH_DISP_IDX_MONITOR2, //!< \~english Monitor2 + VIH_DISP_IDX_MONITOR3, //!< \~english Monitor3 + VIH_DISP_IDX_MONITOR4, //!< \~english Monitor4 + VIH_DISP_IDX_MONITOR5, //!< \~english Monitor5 + VIH_DISP_IDX_NUM_MAX +} VIH_DISP_IDX; + +/** + * \~english Video ID + */ +typedef enum TagVideoInHalVideoOut { + VIH_VIDEO_OUT_MONITOR0 = 0, //!< \~english Monitor0 (Front monitor) + VIH_VIDEO_OUT_MONITOR1, //!< \~english Monitor1 (Rear monitor) + VIH_VIDEO_OUT_MONITOR2, //!< \~english Monitor2 + VIH_VIDEO_OUT_MONITOR3, //!< \~english Monitor3 + VIH_VIDEO_OUT_MONITOR4, //!< \~english Monitor4 + VIH_VIDEO_OUT_MONITOR5, //!< \~english Monitor5 + VIH_VIDEO_OUT_NONE, //!< \~english Monitor none + VIH_VIDEO_OUT_NUM_MAX +} VIH_VIDEO_OUT; + +/** + * \~english Structure for display tone color + */ +typedef struct TagVideoInHalDispTone { + int16_t day; //!< \~english Day screen + int16_t night; //!< \~english Night screen + int16_t force_day; //!< \~english Force day screen + int16_t force_night; //!< \~english Force night screen +} VIH_DISPTONE; + +/** + * \~english Structure for display tone hue + */ +typedef struct TagVideoInHalDispHue { + int16_t day; //!< \~english Day screen + int16_t night; //!< \~english Night screen + int16_t force_day; //!< \~english Force day screen + int16_t force_night; //!< \~english Force night screen +} VIH_DISPHUE; + +/** + * \~english Structure for display tone contrast + */ +typedef struct TagVideoInHalDispContrast { + int16_t day; //!< \~english Day screen + int16_t night; //!< \~english Night screen + int16_t force_day; //!< \~english Force day screen + int16_t force_night; //!< \~english Force night screen +} VIH_DISPCONTRAST; + +/** + * \~english Structure for display tone brightness + */ +typedef struct TagVideoInHalDispBrightness { + int16_t day; //!< \~english Day screen + int16_t night; //!< \~english Night screen + int16_t force_day; //!< \~english Force day screen + int16_t force_night; //!< \~english Force night screen +} VIH_DISPBRIGHTNESS; + +/** + * \~english Structure for display image quality parameters + */ +typedef struct TagVideoInHalDispParamSetUp { + u_int8_t source; //!< \~english Source type for quality setting + u_int8_t reserved[3]; //!< \~english Reserved + VIH_DISPTONE tone; //!< \~english Tone + VIH_DISPHUE hue; //!< \~english Hue + VIH_DISPCONTRAST contrast; //!< \~english Contrast + VIH_DISPBRIGHTNESS brightness; //!< \~english Brightness +} VIH_DISP_PARAM_SETUP; + +/** + * \~english Structure for display parameters + */ +typedef struct TagVideoInHalDispParam { + u_int8_t monitor; //!< \~english Monitor state + u_int8_t reserve[3]; //!< \~english Reserve + VIH_DISP_PARAM_SETUP setup; //!< \~english Quality setting + u_int8_t illumi; //!< \~english Illumination + u_int8_t dimmer; //!< \~english Auto dimmer + u_int8_t mute; //!< \~english Mute + u_int8_t backlight; //!< \~english Back light +} VIH_DISPPARAM; + +/** + * \~english Structure for video tone color + */ +typedef struct TagVideoInHalVideoTone { + int16_t day; //!< \~english Day screen + int16_t night; //!< \~english Night screen + int16_t force_day; //!< \~english Force day screen + int16_t force_night; //!< \~english Force night screen +} VIH_VIDEOTONE; + +/** + * \~english Structure for video tone hue + */ +typedef struct TagVideoInHalVideoHue { + int16_t day; //!< \~english Day screen + int16_t night; //!< \~english Night screen + int16_t force_day; //!< \~english Force day screen + int16_t force_night; //!< \~english Force night screen +} VIH_VIDEOHUE; + +/** + * \~english Structure for video tone contrast + */ +typedef struct TagVideoInHalVideoContrast { + int16_t day; //!< \~english Day screen + int16_t night; //!< \~english Night screen + int16_t force_day; //!< \~english Force day screen + int16_t force_night; //!< \~english Force night screen +} VIH_VIDEOCONTRAST; + +/** + * \~english Structure for video tone brightness + */ +typedef struct TagVideoInHalVideoBrightness { + int16_t day; //!< \~english Day screen + int16_t night; //!< \~english Night screen + int16_t force_day; //!< \~english Force day screen + int16_t force_night; //!< \~english Force night screen +} VIH_VIDEOBRIGHTNESS; + +/** + * \~english Structure for video image quality parameters + */ +typedef struct TagVideoInHalVideoParamSetUp { + u_int8_t source; //!< \~english Source type for quality setting + u_int8_t reserve[3]; //!< \~english reserve + VIH_VIDEOTONE tone; //!< \~english Tone + VIH_VIDEOHUE hue; //!< \~english Hue + VIH_VIDEOCONTRAST contrast; //!< \~english Contrast + VIH_VIDEOBRIGHTNESS brightness; //!< \~english Brightness +} VIH_VIDEO_PARAM_SETUP; + +/** + * \~english Structure for video position and angle + */ +typedef struct TagVideoInHalVideoPos { + u_int32_t aspect_x; //!< \~english Display position x + u_int32_t aspect_y; //!< \~english Display position y + u_int32_t aspect_w; //!< \~english Display width + u_int32_t aspect_h; //!< \~english Display height +} VIH_VIDEOPOS; + +/** + * \~english Structure for video parameters + */ +typedef struct TagVideoInHalVideoParam { + u_int8_t source; //!< \~english Video Source + u_int8_t type; //!< \~english TV type + u_int8_t interlace; //!< \~english De-interlace + u_int8_t aspect; //!< \~english Aspect Value + VIH_VIDEOPOS angle; //!< \~english Angle + VIH_VIDEO_PARAM_SETUP setup; //!< \~english Quality setting + u_int8_t monitor; //!< \~english Monitor + u_int8_t mute; //!< \~english Mute + u_int8_t aspect_ratio; //!< \~english Aspect ratio + u_int8_t reserve; //!< \~english Reserve + u_int32_t window_priority; //!< \~english Window priority +} VIH_VIDEOPARAM; + +/** + * \~english Structure for display identify + */ +typedef struct TagVideoInHalDispVideoID { + VIH_CONTEXT kind; //!< \~english Context type + struct timespec tp; //!< \~english Context create time +} VIH_DISPVIDEOID; + +/** + * \~english Structure for display information + */ +typedef struct TagVideoInHalDispVideoInfo { + VIH_DISPVIDEOID context_id; //!< \~english Context identify + u_int32_t dsp_idx; //!< \~english Display index + u_int32_t chgflg; //!< \~english Setting change flag +} VIH_DISPVIDEOINFO; + +/** + * \~english Structure for display context + */ +typedef struct TagVideoInHalDispMngCtx { + VIH_DISPVIDEOINFO info; //!< \~english Display information + VIH_DISPPARAM disp_param[VIH_DISP_IDX_NUM_MAX]; //!< \~english Display parameter + VIH_VIDEOPARAM video_param[VIH_VIDEO_OUT_NUM_MAX]; //!< \~english Video parameter +} VIH_DISPMNGCTX; + +/** + * \~english Structure for diagnosis code data + */ +typedef struct TagVideoInHalGRMainReqDiagData { + uint64_t err_id; //!< \~english Error ID + uint16_t videoinhal_code; //!< \~english Code + uint8_t reserve1[2]; //!< \~english Reserve +} VIH_GR_MAIN_REQ_DIAGDATA; + + +/** + * \ingroup SendDiagCodeCallBack + * \~english @par Brief + * Send diagnosis code call back. + * \~english @param [in] snd_info + * u_int16_t - Send information + * \~english @param [in] msg_id + * u_int32_t - Message ID + * \~english @param [in] diag_data + * VIH_GR_MAIN_REQ_DIAGDATA* - Diagnosis code data + * \~english @par + * u_int16_t snd_info + * \~english @code + * VIH_DISP_SEQ_CTRL 0x0003 // Sequence control + * VIH_DISP_VCAP1_CTRL 0x0005 // Video capture1 control + * VIH_DISP_VCAP2_CTRL 0x0006 // Video capture2 control + * @endcode + * \~english @par + * u_int32_t msg_id + * \~english @code + * VIH_DISP_MAIN_IND_PUTDIAG (0x5200) // Put diagnosis code + * VIH_DISP_MAIN_IND_DELDIAG (0x5201) // Delete diagnosis code + * @endcode + * \~english @par + * VIH_GR_MAIN_REQ_DIAGDATA struct + * \~english @code + * typedef struct TagVideoInHalGRMainReqDiagData + * { + * uint64_t err_id; // Error ID + * uint16_t videoinhal_code; // Videoinhal code + * uint8_t reserve1[2]; // Reserve + * } VIH_GR_MAIN_REQ_DIAGDATA; + * @endcode + * \~english @retval 0 : OK + * \~english @retval -1 : Invalid parameter + * \~english @par Detail + * - Notify diagnosis code request to graphics_service. + * \~english @par Prerequisite + * - None + * \~english @par Conditions of processing failure + * - When input parameter diag_data is NULL, return with error. [-1] + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +typedef int (*SendDiagCodeCallBack)(u_int16_t snd_info, u_int32_t msg_id, VIH_GR_MAIN_REQ_DIAGDATA* diag_data); + +/** + * \ingroup InitVideo + * \~english @par Brief + * API to display device initialize. + * \~english @param [in] call_back + * SendDiagCodeCallBack - Send diagnosis trace code call back function + * \~english @retval VIH_RET_SUCCESS : OK + * \~english @retval VIH_RET_INVALID_PARAMETER : Invalid parameter + * \~english @par Detail + * - Display device initialize, init parameter and threads. + * - The API can only be used by 1 process. + * \~english @par Prerequisite + * - None + * \~english @par Conditions of processing failure + * - When display device driver can not be found, return with error. [VIH_RET_INVALID_PARAMETER] + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +VIH_RET InitVideo(SendDiagCodeCallBack call_back); + +/** + * \ingroup ControlVideo + * \~english @par Brief + * API to Control display device. + * \~english @param [in] pctx + * VIH_DISPMNGCTX* - Point of parameter used by control display device + * \~english @param [in] event_id + * VIH_EVENTID - Event ID + * \~english @param [in] control_id + * VIH_CONTROLID - Control ID + * \~english @par + * VIH_DISPMNGCTX struct + * \~english @code + * typedef struct TagVideoInHalDispMngCtx + * { + * VIH_DISPVIDEOINFO info; // Information of display + * VIH_DISPPARAM disp_param[VIH_DISP_IDX_NUM_MAX]; // Paramter of diaplay + * VIH_VIDEOPARAM video_param[VIH_VIDEO_OUT_NUM_MAX]; // Paramter of video + * } VIH_DISPMNGCTX; + * @endcode + * \~english @par + * VIH_EVENTID enum + * \~english @code + * typedef enum TagVideoInHalEventID + * { + * VIH_EVENT_ID_SOURCE, // Display source change + * VIH_EVENT_ID_QUALITY, // Set quality(display) + * VIH_EVENT_ID_VIDEOQUALITY, // Set quality(video) + * VIH_EVENT_ID_ASPECT, // Set aspect + * VIH_EVENT_ID_MONITOR, // Set monitor(display) + * VIH_EVENT_ID_VIDEOVISIBLE, // Set video visible(video) + * VIH_EVENT_ID_MUTE, // Set mute + * VIH_EVENT_ID_BACKLIGHT, // Set backlight + * VIH_EVENT_ID_NUM_MAX + * } VIH_EVENTID; + * @endcode + * \~english @par + * VIH_CONTROLID enum + * \~english @code + * typedef enum TagVideoInHalControlID + * { + * VIH_CONTROL_ID_SOURCE, // Display source change + * VIH_CONTROL_ID_QUALITY, // Set quality(display) + * VIH_CONTROL_ID_VIDEOQUALITY, // Set quality(video) + * VIH_CONTROL_ID_ASPECT, // Set aspect + * VIH_CONTROL_ID_MONITOR, // Set monitor(display) + * VIH_CONTROL_ID_VIDEOVISIBLE, // Set video visible(video) + * VIH_CONTROL_ID_START_CAPTURE, // Start capture + * VIH_CONTROL_ID_STOP_CAPTURE, // Stop capture + * VIH_CONTROL_ID_TVTYPE, // Set TV type + * VIH_CONTROL_ID_DEINTERLACE, // Set de-interlace + * VIH_CONTROL_ID_VMUTE, // Set mute + * VIH_CONTROL_ID_BACKLIGHT, // Set backlight + * VIH_CONTROL_ID_NUM_MAX + * } VIH_CONTROLID; + * @endcode + * \~english @retval VIH_RET_SUCCESS : OK + * \~english @retval VIH_RET_INVALID_PARAMETER : Invalid parameter + * \~english @retval VIH_RET_INTERNAL_ERROR : Internal error + * \~english @par Detail + * - Control display device. Include display source, quality(display), quality(video), aspect , monitor, video visible, start capture, stop capture, mute, backlight, TV type, de-interlace. + * - The API can only be used by 1 process. + * \~english @par Prerequisite + * - Call InitVideo() + * \~english @par Conditions of processing failure + * - The point param is null [VIH_RET_INVALID_PARAMETER] + * - The display driver return error [VIH_RET_INTERNAL_ERROR] + * \~english @par Classification + * Public + * \~english @par Type + * Fire and Forget + * \~english @see + * None + */ +VIH_RET ControlVideo(VIH_DISPMNGCTX* pctx, VIH_EVENTID event_id, VIH_CONTROLID control_id); + +/** + * \ingroup TerminateVideo + * \~english @par Brief + * API to display device Terminate. + * \~english @param None + * \~english @retval VIH_RET_SUCCESS : OK + * \~english @par Detail + * - Display device Terminate, init parameter. + * - The API can only be used by 1 process. + * \~english @par Prerequisite + * - Call InitVideo(). + * \~english @par Conditions of processing failure + * - None + * \~english @par Classification + * Public + * \~english @par Type + * Sync + * \~english @see + * None + */ +VIH_RET TerminateVideo(); + +#ifdef __cplusplus +} +#endif + +/** @}*/ //!< end of video_in_hal +/** @}*/ //!< end of graphics_service + +#endif // HAL_API_VIDEO_IN_HAL_H_ diff --git a/src/video_in_hal.c b/src/video_in_hal.c new file mode 100644 index 00000000..b639a838 --- /dev/null +++ b/src/video_in_hal.c @@ -0,0 +1,50 @@ +/* + * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Information. + * This source code is a sample source code . + * Implementation of the function must be performed by the vendor. + */ + +#include "video_in_hal.h" + +VIH_RET InitVideo(SendDiagCodeCallBack call_back) +{ + /* + * Note. + * This feature needs to be implemented by the vendor. + */ + return VIH_RET_SUCCESS; +} + +VIH_RET ControlVideo(VIH_DISPMNGCTX* pctx, VIH_EVENTID event_id, VIH_CONTROLID control_id) +{ + /* + * Note. + * This feature needs to be implemented by the vendor. + */ + return VIH_RET_SUCCESS; +} + +VIH_RET TerminateVideo() +{ + /* + * Note. + * This feature needs to be implemented by the vendor. + */ + return VIH_RET_SUCCESS; +} -- cgit 1.2.3-korg