atmel_pio4.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2015 Atmel Corporation.
  3. * Wenyou Yang <wenyou.yang@atmel.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __ATMEL_PIO4_H
  8. #define __ATMEL_PIO4_H
  9. #ifndef __ASSEMBLY__
  10. struct atmel_pio4_port {
  11. u32 mskr; /* 0x00 PIO Mask Register */
  12. u32 cfgr; /* 0x04 PIO Configuration Register */
  13. u32 pdsr; /* 0x08 PIO Pin Data Status Register */
  14. u32 locksr; /* 0x0C PIO Lock Status Register */
  15. u32 sodr; /* 0x10 PIO Set Output Data Register */
  16. u32 codr; /* 0x14 PIO Clear Output Data Register */
  17. u32 odsr; /* 0x18 PIO Output Data Status Register */
  18. u32 reserved0;
  19. u32 ier; /* 0x20 PIO Interrupt Enable Register */
  20. u32 idr; /* 0x24 PIO Interrupt Disable Register */
  21. u32 imr; /* 0x28 PIO Interrupt Mask Register */
  22. u32 isr; /* 0x2C PIO Interrupt Status Register */
  23. u32 reserved1[3];
  24. u32 iofr; /* 0x3C PIO I/O Freeze Register */
  25. };
  26. #endif
  27. #define AT91_PIO_PORTA 0x0
  28. #define AT91_PIO_PORTB 0x1
  29. #define AT91_PIO_PORTC 0x2
  30. #define AT91_PIO_PORTD 0x3
  31. int atmel_pio4_set_gpio(u32 port, u32 pin, u32 use_pullup);
  32. int atmel_pio4_set_a_periph(u32 port, u32 pin, u32 use_pullup);
  33. int atmel_pio4_set_b_periph(u32 port, u32 pin, u32 use_pullup);
  34. int atmel_pio4_set_c_periph(u32 port, u32 pin, u32 use_pullup);
  35. int atmel_pio4_set_d_periph(u32 port, u32 pin, u32 use_pullup);
  36. int atmel_pio4_set_e_periph(u32 port, u32 pin, u32 use_pullup);
  37. int atmel_pio4_set_f_periph(u32 port, u32 pin, u32 use_pullup);
  38. int atmel_pio4_set_g_periph(u32 port, u32 pin, u32 use_pullup);
  39. int atmel_pio4_set_pio_output(u32 port, u32 pin, u32 value);
  40. int atmel_pio4_get_pio_input(u32 port, u32 pin);
  41. #endif