csi_common.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #ifndef __CSI_COMMON_H__
  10. #define __CSI_COMMON_H__
  11. #include <stdint.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
  16. typedef union csi_api_version {
  17. struct {
  18. uint16_t minor;
  19. uint16_t major;
  20. };
  21. uint32_t version;
  22. } csi_api_version_u;
  23. typedef struct csi_size {
  24. uint32_t width;
  25. uint32_t height;
  26. } csi_size_s;
  27. typedef struct csi_rect {
  28. uint32_t pos_x;
  29. uint32_t pos_y;
  30. uint32_t width;
  31. uint32_t height;
  32. } csi_rect_s;
  33. enum {
  34. CSI_IO_PATTERN_INTERNAL_MEMORY = 0x01, /* Internal preparation IO memory mode */
  35. CSI_IO_PATTERN_EXTERNAL_MEMORY = 0x02 /* External preparation IO memory mode */
  36. };
  37. typedef enum csi_common_err_code {
  38. CSI_SUCCESS,
  39. CSI_ERR_BAD_PARAM,
  40. CSI_ERR_NOT_SUPPORT,
  41. CSI_ERR_BUSY,
  42. CSI_ERR_OUT_OF_MEMORY,
  43. CSI_ERR_NEED_MORE_DATA,
  44. CSI_ERR_NEED_MORE_IO_FRAME,
  45. CSI_ERR_TIMEOUT,
  46. CSI_ERR_WAIT
  47. } csi_common_err_code_e;
  48. int32_t csi_hal_init();
  49. int32_t csi_hal_deinit();
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif /* __CSI_COMMON_H__ */