ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

hwsynkp.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactOS Boot Loader
00003  * LICENSE:         BSD - See COPYING.ARM in the top level directory
00004  * FILE:            boot/armllb/hw/omap3-zoom2/hwsynkpd.c
00005  * PURPOSE:         LLB Synpatics Keypad Support for OMAP3 ZOOM 2
00006  * PROGRAMMERS:     ReactOS Portable Systems Group
00007  */
00008 
00009 #include "precomp.h"
00010 
00011 /* FUNCTIONS ******************************************************************/
00012 
00013 VOID
00014 NTAPI
00015 LlbHwOmap3SynKpdInitialize(VOID)
00016 {
00017     /* Set GPIO pin 8 on the TWL4030 as an output pin */
00018     LlbHwOmap3TwlWrite1(0x49, 0x9B, 0xC0);
00019 
00020     /* Set GPIO pin 8 signal on the TWL4030 ON. This powers the keypad backlight */
00021     LlbHwOmap3TwlWrite1(0x49, 0xA4, 0xC0);
00022     
00023     /* Set PENDDIS and COR on the the keypad interrupt controller */
00024     LlbHwOmap3TwlWrite1(0x4A, 0xE9, 0x06);
00025 
00026     /* Only falling edge detection for key pressed */
00027     LlbHwOmap3TwlWrite1(0x4A, 0xE8, 0x01);
00028     
00029     /* Unmask key-pressed events */
00030     LlbHwOmap3TwlWrite1(0x4A, 0xE4, 0x0E);
00031 
00032     /* Set the keypad control register to turn hardware sequencing and turn it on */
00033     LlbHwOmap3TwlWrite1(0x4A, 0xD2, 0x0);
00034     LlbHwOmap3TwlRead1(0x4A, 0xE3);
00035     LlbHwOmap3TwlWrite1(0x4A, 0xD2, 0x43);
00036 }
00037 
00038 UCHAR KeyboardMatrixStatus[8];
00039 BOOLEAN LastState = FALSE;
00040 
00041 BOOLEAN
00042 NTAPI
00043 LlbHwKbdReady(VOID)
00044 {
00045     UCHAR Value;
00046 
00047     Value = LlbHwOmap3TwlRead1(0x4A, 0xE3);
00048     if (!Value) return FALSE;
00049     
00050     LastState ^= 1;
00051     if (!LastState) return FALSE;
00052     
00053     /* Return whether or not an interrupt is pending */
00054     return TRUE;
00055 }
00056 
00057 INT
00058 NTAPI
00059 LlbHwKbdRead(VOID)
00060 {
00061     UCHAR ActiveCol = 0, ActiveRow = 0, col, coldata, row;
00062     
00063     for (col = 0; col < 8; col++)
00064     {
00065         coldata = LlbHwOmap3TwlRead1(0x4A, 0xDB + col);
00066         if (coldata)
00067         {
00068             for (row = 0; row < 8; row++)
00069             {
00070                 if (coldata == (1 << row))
00071                 {
00072                     ActiveRow = row;
00073                     ActiveCol = col;
00074                     break;
00075                 }
00076             }
00077         }
00078     }
00079     
00080     return ((ActiveCol << 4) | ActiveRow);
00081 }
00082 
00083 /* EOF */

Generated on Mon May 28 2012 04:18:37 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.