ck_sha.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /******************************************************************************
  17. * @file ck_sha.h
  18. * @brief header file for sha driver
  19. * @version V1.0
  20. * @date 02. June 2017
  21. ******************************************************************************/
  22. #ifndef _CK_SHA_H_
  23. #define _CK_SHA_H_
  24. #include <stdio.h>
  25. #include "drv_sha.h"
  26. #include "soc.h"
  27. #define SHA_INIT_OFFSET 3
  28. #define SHA_INT_ENABLE_OFFSET 4
  29. #define SHA_ENDIAN_OFFSET 5
  30. #define SHA_CAL_OFFSET 6
  31. typedef struct {
  32. __IOM uint32_t SHA_CON; /* Offset: 0x000 (R/W) Control register */
  33. __IOM uint32_t SHA_INTSTATE; /* Offset: 0x004 (R/W) Instatus register */
  34. __IOM uint32_t SHA_H0L; /* Offset: 0x008 (R/W) H0L register */
  35. __IOM uint32_t SHA_H1L; /* Offset: 0x00c (R/W) H1L register */
  36. __IOM uint32_t SHA_H2L; /* Offset: 0x010 (R/W) H2L register */
  37. __IOM uint32_t SHA_H3L; /* Offset: 0x014 (R/W) H3L register */
  38. __IOM uint32_t SHA_H4L; /* Offset: 0x018 (R/W) H4L register */
  39. __IOM uint32_t SHA_H5L; /* Offset: 0x01c (R/W) H5L register */
  40. __IOM uint32_t SHA_H6L; /* Offset: 0x020 (R/W) H6L register */
  41. __IOM uint32_t SHA_H7L; /* Offset: 0x024 (R/W) H7L register */
  42. __IOM uint32_t SHA_H0H; /* Offset: 0x028 (R/W) H0H register */
  43. __IOM uint32_t SHA_H1H; /* Offset: 0x02c (R/W) H1H register */
  44. __IOM uint32_t SHA_H2H; /* Offset: 0x030 (R/W) H2H register */
  45. __IOM uint32_t SHA_H3H; /* Offset: 0x034 (R/W) H3H register */
  46. __IOM uint32_t SHA_H4H; /* Offset: 0x038 (R/W) H4H register */
  47. __IOM uint32_t SHA_H5H; /* Offset: 0x03c (R/W) H5H register */
  48. __IOM uint32_t SHA_H6H; /* Offset: 0x040 (R/W) H6H register */
  49. __IOM uint32_t SHA_H7H; /* Offset: 0x044 (R/W) H7H register */
  50. __IOM uint32_t SHA_DATA1; /* Offset: 0x048 (R/W) DATA1 register */
  51. uint32_t REV[15];
  52. __IOM uint32_t SHA_DATA2; /* Offset: 0x088 (R/W) DATA2 register */
  53. } ck_sha_reg_t;
  54. #endif
  55. typedef enum {
  56. SHA_STATUS_START_END = 0, /* the one time count mode */
  57. SHA_STATUS_START = 1, /* the first time of the cal */
  58. SHA_STATUS_CONTINUE = 2, /* the middle stage of the cal */
  59. SHA_STATUS_END = 3 /* the last time of the cal*/
  60. } enum_sha_status;