wiringCPi.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _WIRING_CPI_H
  2. #define _WIRING_CPI_H
  3. #ifdef CONFIG_CLOCKWORKPI_A04
  4. #define GPIOA_BASE (0x0300B000)
  5. #define GPIO_NUM (0x40)
  6. #define GPIO_BASE_MAP (0x0300B000)
  7. #define MEM_INFO (1024)
  8. #define GPIOL_BASE (0x07022000)
  9. #define GPIOL_BASE_MAP (0x07022000)
  10. #define MAP_SIZE_L (4096 * 1)
  11. #define GPIO_PWM_OP (0x0300A000)
  12. #endif
  13. #ifdef CONFIG_CLOCKWORKPI_A06
  14. #define GPIO0_BASE 0xff720000
  15. #define GPIO1_BASE 0xff730000
  16. #define GPIO2_BASE 0xff780000
  17. #define GPIO3_BASE 0xff788000
  18. #define GPIO4_BASE 0xff790000
  19. #define GPIO_NUM (160)
  20. #define GPIO_SWPORTA_DR_OFFSET 0x00
  21. #define GPIO_SWPORTA_DDR_OFFSET 0x04
  22. #define GPIO_EXT_PORTA_OFFSET 0x50
  23. #define PMUGRF_BASE 0xff320000
  24. #define GRF_BASE 0xff77e000
  25. #define CRU_BASE 0xff760000
  26. #define PMUCRU_BASE 0xff750000
  27. #define CRU_CLKGATE_CON31_OFFSET 0x037c //bit 3 4 5
  28. #define PMUCRU_CLKGATE_CON1_OFFSET 0x0104
  29. #endif
  30. #define MAP_SIZE_L (4*1024)
  31. #define MAP_SIZE MAP_SIZE_L
  32. #define MAP_MASK (MAP_SIZE - 1)
  33. extern int CPi_set_gpio_mode(int pin, int mode);
  34. extern int CPi_set_gpio_alt(int pin, int mode);
  35. extern int CPi_get_gpio_mode(int pin);
  36. extern void CPi_digitalWrite(int pin, int value);
  37. extern int CPi_digitalRead(int pin);
  38. extern void CPiSetupRaw(void);
  39. #endif