foox_hw.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Copyright : (C) 2022 Phytium Information Technology, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is OPEN SOURCE software: you can redistribute it and/or modify it
  6. * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
  7. * either version 1.0 of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
  10. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. * See the Phytium Public License for more details.
  12. *
  13. *
  14. * FilePath: foox_hw.h
  15. * Date: 2022-02-10 14:53:42
  16. * LastEditTime: 2022-02-18 08:24:52
  17. * Description:  This files is for
  18. *
  19. * Modify History:
  20. * Ver   Who        Date         Changes
  21. * ----- ------     --------    --------------------------------------
  22. */
  23. #ifndef DRIVERS_XXXX_FOOXX_HW_H
  24. #define DRIVERS_XXXX_FOOXX_HW_H
  25. /* - 传入模块基地址,不能复杂结构体
  26. - hardware interface of device || low-level driver function prototypes
  27. - 包括驱动寄存器参数和low-level操作定义
  28. 1. 定义寄存器偏移
  29. 2. 对上提供该模块寄存器操作的接口
  30. 3. 一些简单外设提供直接操作接口
  31. 4. 可以定义一些状态的接口,用于响应驱动状态的变化
  32. note: 本文件不能引用fooxx.h
  33. */
  34. #ifdef __cplusplus
  35. extern "C"
  36. {
  37. #endif
  38. /***************************** Include Files *********************************/
  39. #include "fparameters.h"
  40. #include "fio.h"
  41. /************************** Constant Definitions *****************************/
  42. /**************************** Type Definitions *******************************/
  43. /************************** Variable Definitions *****************************/
  44. /***************** Macros (Inline Functions) Definitions *********************/
  45. /** @name Register Map
  46. *
  47. * Register offsets from the base address of an SD device.
  48. * @{
  49. */
  50. #define FOOXX_XX_OFFSET
  51. /** @name FOOXX_XX_OFFSET Register
  52. */
  53. #define FOOXX_XX_STATE
  54. #define FOOXX_READ_REG32(addr, reg_offset) FtIn32((addr) + (u32)(reg_offset))
  55. #define FOOXX_WRITE_REG32(addr, reg_offset, reg_value) FtOut32((addr) + (u32)(reg_offset), (u32)(reg_value))
  56. /************************** Function Prototypes ******************************/
  57. void FooxHwWrite(uintptr base, char byte);
  58. char FooxHwRead(uintptr base);
  59. #ifdef __cplusplus
  60. }
  61. #endif