ReactOS  0.4.15-dev-1070-ge1a01de
hwsynkp.c File Reference
#include "precomp.h"
Include dependency graph for hwsynkp.c:

Go to the source code of this file.

Functions

VOID NTAPI LlbHwOmap3SynKpdInitialize (VOID)
 
BOOLEAN NTAPI LlbHwKbdReady (VOID)
 
INT NTAPI LlbHwKbdRead (VOID)
 

Variables

UCHAR KeyboardMatrixStatus [8]
 
BOOLEAN LastState = FALSE
 

Function Documentation

◆ LlbHwKbdRead()

INT NTAPI LlbHwKbdRead ( VOID  )

Definition at line 59 of file hwsynkp.c.

60 {
61  UCHAR ActiveCol = 0, ActiveRow = 0, col, coldata, row;
62 
63  for (col = 0; col < 8; col++)
64  {
65  coldata = LlbHwOmap3TwlRead1(0x4A, 0xDB + col);
66  if (coldata)
67  {
68  for (row = 0; row < 8; row++)
69  {
70  if (coldata == (1 << row))
71  {
72  ActiveRow = row;
73  ActiveCol = col;
74  break;
75  }
76  }
77  }
78  }
79 
80  return ((ActiveCol << 4) | ActiveRow);
81 }
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR NTAPI LlbHwOmap3TwlRead1(IN UCHAR ChipAddress, IN UCHAR RegisterAddress)
Definition: hwtwl40x.c:15
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78

◆ LlbHwKbdReady()

BOOLEAN NTAPI LlbHwKbdReady ( VOID  )

Definition at line 43 of file hwsynkp.c.

44 {
45  UCHAR Value;
46 
47  Value = LlbHwOmap3TwlRead1(0x4A, 0xE3);
48  if (!Value) return FALSE;
49 
50  LastState ^= 1;
51  if (!LastState) return FALSE;
52 
53  /* Return whether or not an interrupt is pending */
54  return TRUE;
55 }
#define TRUE
Definition: types.h:120
IN UCHAR Value
Definition: halp.h:394
#define FALSE
Definition: types.h:117
unsigned char UCHAR
Definition: xmlstorage.h:181
BOOLEAN LastState
Definition: hwsynkp.c:39
UCHAR NTAPI LlbHwOmap3TwlRead1(IN UCHAR ChipAddress, IN UCHAR RegisterAddress)
Definition: hwtwl40x.c:15

◆ LlbHwOmap3SynKpdInitialize()

VOID NTAPI LlbHwOmap3SynKpdInitialize ( VOID  )

Definition at line 15 of file hwsynkp.c.

16 {
17  /* Set GPIO pin 8 on the TWL4030 as an output pin */
18  LlbHwOmap3TwlWrite1(0x49, 0x9B, 0xC0);
19 
20  /* Set GPIO pin 8 signal on the TWL4030 ON. This powers the keypad backlight */
21  LlbHwOmap3TwlWrite1(0x49, 0xA4, 0xC0);
22 
23  /* Set PENDDIS and COR on the the keypad interrupt controller */
24  LlbHwOmap3TwlWrite1(0x4A, 0xE9, 0x06);
25 
26  /* Only falling edge detection for key pressed */
27  LlbHwOmap3TwlWrite1(0x4A, 0xE8, 0x01);
28 
29  /* Unmask key-pressed events */
30  LlbHwOmap3TwlWrite1(0x4A, 0xE4, 0x0E);
31 
32  /* Set the keypad control register to turn hardware sequencing and turn it on */
33  LlbHwOmap3TwlWrite1(0x4A, 0xD2, 0x0);
34  LlbHwOmap3TwlRead1(0x4A, 0xE3);
35  LlbHwOmap3TwlWrite1(0x4A, 0xD2, 0x43);
36 }
GLint x0
Definition: linetemp.h:95
VOID NTAPI LlbHwOmap3TwlWrite1(IN UCHAR ChipAddress, IN UCHAR RegisterAddress, IN UCHAR Value)
Definition: hwtwl40x.c:61
UCHAR NTAPI LlbHwOmap3TwlRead1(IN UCHAR ChipAddress, IN UCHAR RegisterAddress)
Definition: hwtwl40x.c:15

Referenced by LlbHwInitialize().

Variable Documentation

◆ KeyboardMatrixStatus

UCHAR KeyboardMatrixStatus[8]

Definition at line 38 of file hwsynkp.c.

◆ LastState

BOOLEAN LastState = FALSE

Definition at line 39 of file hwsynkp.c.

Referenced by Ext2McbReaperThread(), and LlbHwKbdReady().