Subject: src/sys/arch/pmax/dev/lk201.c question
To: None <port-pmax@NetBSD.ORG>
From: Dan McMahill <mcmahill@mtl.mit.edu>
List: port-pmax
Date: 03/13/1998 18:46:33
I have a question about a piece of the code in src/sys/arch/pmax/dev/lk201.c

I suppose its actually somewhat of a hardware question since the code talks
to the hardware.  If anyone has some more detailed LK201 hardware docuemntation
which would explain this, I would really appreciate a copy.

The code fragment in question is attached. The "normal" c-style comments /*this*/
are from the NetBSD code, the c++ style //ie like this
are my questions/comments


// from lk201.c

// the following keyboard initialization string is sent to the LK201 keyboard
// by KBDReset().  Most of it makes sense, there is however a section that
// I don't understand what it does.


/* 
 * Keyboard initialization string.
 */
static u_char kbdInitString[] = {
        LK_LED_ENABLE, LED_ALL,         /* show we are resetting keyboard */  
        LK_DEFAULTS,

// I don't understand from here to

        LK_CMD_MODE(LK_AUTODOWN, 1),  
        LK_CMD_MODE(LK_AUTODOWN, 2),  
        LK_CMD_MODE(LK_AUTODOWN, 3),  
        LK_CMD_MODE(LK_DOWN, 4),        /* could also be LK_AUTODOWN */
        LK_CMD_MODE(LK_UPDOWN, 5),   
        LK_CMD_MODE(LK_UPDOWN, 6),   
        LK_CMD_MODE(LK_AUTODOWN, 7), 
        LK_CMD_MODE(LK_AUTODOWN, 8), 
        LK_CMD_MODE(LK_AUTODOWN, 9), 
        LK_CMD_MODE(LK_AUTODOWN, 10), 
        LK_CMD_MODE(LK_AUTODOWN, 11), 
        LK_CMD_MODE(LK_AUTODOWN, 12), 
        LK_CMD_MODE(LK_DOWN, 13), 
        LK_CMD_MODE(LK_AUTODOWN, 14),

// here




        LK_AR_ENABLE,                   /* we want autorepeat by default */
        LK_CL_ENABLE, 0x83,             /* keyclick, volume */
        LK_KBD_ENABLE,                  /* the keyboard itself */
        LK_BELL_ENABLE, 0x83,           /* keyboard bell, volume */
        LK_LED_DISABLE, LED_ALL,        /* clear keyboard leds */
};


// from lk201.h 

// these are the #define's for the part I don't understand.

/*
 * Lk201/301 keyboard
 */
#define LK_UPDOWN       0x86            /* bits for setting lk201 modes */
#define LK_AUTODOWN     0x82
#define LK_DOWN         0x80


/* mode command details */
#define LK_CMD_MODE(m,div)              ((m)|((div)<<3))





Thanks

Dan