Subversion Repositories Kolibri OS

Rev

Rev 8327 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #ifndef _PXA255_GPIO_H_
  2. #define _PXA255_GPIO_H_
  3.  
  4. #include "mem.h"
  5. #include "CPU.h"
  6. #include "pxa255_IC.h"
  7.  
  8. /*
  9.         PXA255 OS GPIO controller
  10.  
  11. */
  12.  
  13. #define PXA255_GPIO_BASE                0x40E00000UL
  14. #define PXA255_GPIO_SIZE                0x00001000UL
  15.  
  16.  
  17. typedef struct{
  18.  
  19.         Pxa255ic* ic;
  20.        
  21.         UInt32 latches[3];              //what pxa wants to be outputting
  22.         UInt32 inputs[3];               //what pxa is receiving [only set by the pxa255gpioSetState() API]
  23.         UInt32 levels[3];               //what pxa sees (it differs from above for IN pins)
  24.         UInt32 dirs[3];                 //1 = output
  25.         UInt32 riseDet[3];              //1 = rise detect
  26.         UInt32 fallDet[3];              //1 = fall detect
  27.         UInt32 detStatus[3];            //1 = detect happened
  28.         UInt32 AFRs[6];                 //1, 2, 3 = alt funcs
  29.        
  30. }Pxa255gpio;
  31.  
  32. #define PXA255_GPIO_LOW                 0               //these values make it look like all HiZ, AFR, and nonexistent pins have pullups to those who dumbly assume gpioGEt returns a boolean
  33. #define PXA255_GPIO_HIGH                1
  34. #define PXA255_GPIO_HiZ                 2
  35. #define PXA255_GPIO_AFR1                3
  36. #define PXA255_GPIO_AFR2                4
  37. #define PXA255_GPIO_AFR3                5
  38. #define PXA255_GPIO_NOT_PRESENT         6
  39.  
  40. Boolean pxa255gpioInit(Pxa255gpio* gpio, ArmMem* physMem, Pxa255ic* ic);
  41.  
  42. //for external use :)
  43. UInt8 pxa255gpioGetState(Pxa255gpio* gpio, UInt8 gpioNum);
  44. void pxa255gpioSetState(Pxa255gpio* gpio, UInt8 gpioNum, Boolean on);   //we can only set value (and only of input pins), not direction
  45.  
  46. #endif
  47.  
  48.