m5_isp_shutter.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 0x00000680
  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. {"ISP_SH_CTRL", "Mechanical shutter control",
  20. 0x00000680, 0x00000000, 4, 4, "sh_open_pol", "Shutter_open polarity. 0: high active; 1: low active"},
  21. {NULL, NULL, 0x00000680, 0x00000000, 3, 3, "sh_trig_pol", "Mechanical shutter trigger edge." LINE_PADDING_6TAB
  22. "0: use negative edge of trigger signal" LINE_PADDING_6TAB
  23. "1: use positive edge of trigger signal"},
  24. {NULL, NULL, 0x00000680, 0x00000000, 2, 2, "sh_trig_src", "Mechanical shutter trigger source." LINE_PADDING_6TAB
  25. "0: use “vds_vsync” for trigger event" LINE_PADDING_6TAB
  26. "1: use “shutter_trig” for trigger event"},
  27. {NULL, NULL, 0x00000680, 0x00000000, 1, 1, "sh_rep_en", "Mechanical shutter repetition enable." LINE_PADDING_6TAB
  28. "0: shutter is opened only once" LINE_PADDING_6TAB
  29. "1: shutter is opened with the repetition rate of the trigger signal"},
  30. {NULL, NULL, 0x00000680, 0x00000000, 0, 0, "sh_en", "Mechanical shutter. 0: disable; 1: enable"},
  31. };
  32. int light_isp_shutter_reg_dump(reg_analyzer_info_s *ra_info)
  33. {
  34. uint32_t count = sizeof(reg_desc) / sizeof(reg_desc[0]);
  35. return ra_dump_reg_fields(ra_info, reg_desc, count);
  36. }
  37. int light_isp_shutter_reg_define(reg_analyzer_info_s *ra_info)
  38. {
  39. uint32_t count = sizeof(reg_desc) / sizeof(reg_desc[0]);
  40. return ra_dump_reg_define(ra_info, reg_desc, count);
  41. }
  42. int light_isp_shutter_reg_find(reg_analyzer_info_s *ra_info)
  43. {
  44. uint32_t count = sizeof(reg_desc) / sizeof(reg_desc[0]);
  45. return ra_dump_reg_find(ra_info, reg_desc, count);
  46. }