m5_cproc.c 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (C) 2021 Alibaba Group Holding Limited
  3. * Author: LuChongzhi <chongzhi.lcz@alibaba-inc.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <stdint.h>
  12. #include <unistd.h>
  13. #include <string.h>
  14. #include "ra_common.h"
  15. #define REG_BASE 0x800
  16. static const reg_field_s reg_desc[] = {
  17. /* structure field order
  18. reg_name, offset,reset_value,msb,lsb, field_name, field_desc */
  19. {"CPROC_CTRL", "Global control register",
  20. 0x00000800, 0x00000000, 3, 3, "cproc_c_out_range", "Color processing chrominance pixel clipping range at output" LINE_PADDING_6TAB
  21. " 0: CbCr_out clipping range [16..240] according to ITU-R BT.601 standard" LINE_PADDING_6TAB
  22. " 1: Full UV_out clipping range [0..255]"},
  23. {NULL, NULL, 0x00000800, 0x00000000, 2, 2, "cproc_y_in_range", "Color processing luminance input range (offset processing)" LINE_PADDING_6TAB
  24. " 0: Y_in range [64..940] according to ITU-R BT.601 standard;" LINE_PADDING_6TAB
  25. " offset of 64 will be subtracted from Y_in" LINE_PADDING_6TAB
  26. " 1: Y_in full range [0..1023]; no offset will be subtracted from Y_in"},
  27. {NULL, NULL, 0x00000800, 0x00000000, 1, 1, "cproc_y_out_range", "Color processing luminance output clipping range" LINE_PADDING_6TAB
  28. " 0: Y_out clipping range [16..235];" LINE_PADDING_6TAB
  29. " offset of 16 is added to Y_out according to ITU-R BT.601 standard" LINE_PADDING_6TAB
  30. " 1: Y_out clipping range [0..255]; no offset is added to Y_out"},
  31. {NULL, NULL, 0x00000800, 0x00000000, 0, 0, "cproc_enable", "Color processing enable" LINE_PADDING_6TAB
  32. " 0: Color processing is bypassed" LINE_PADDING_6TAB
  33. " 1: Color processing is active" LINE_PADDING_6TAB
  34. " 2 * 10 bit input data are truncated to 2 * 8 bit output data" LINE_PADDING_6TAB
  35. " output data are rounded to 2 * 8 bit and clipping is active"},
  36. };
  37. int light_isp_cproc_reg_dump(reg_analyzer_info_s *ra_info)
  38. {
  39. uint32_t count = sizeof(reg_desc) / sizeof(reg_desc[0]);
  40. return ra_dump_reg_fields(ra_info, reg_desc, count);
  41. }
  42. int light_isp_cproc_reg_define(reg_analyzer_info_s *ra_info)
  43. {
  44. uint32_t count = sizeof(reg_desc) / sizeof(reg_desc[0]);
  45. return ra_dump_reg_define(ra_info, reg_desc, count);
  46. }
  47. int light_isp_cproc_reg_find(reg_analyzer_info_s *ra_info)
  48. {
  49. uint32_t count = sizeof(reg_desc) / sizeof(reg_desc[0]);
  50. return ra_dump_reg_find(ra_info, reg_desc, count);
  51. }