The keyboard driver is made up several levels:
the keyboard hardware, which turns the user's finger moves into so-called scancodes (Disclaimer: this is not really part of the software driver itself; no support is provided for bugs in this domain ;-). An event (key pressed or released) generates a sequence composed of 1 to 6 scancodes.
a mechanism turning scancodes into one of 127 possible keycodes using a translation-table which you can access with the getkeycodes(8) and setkeycodes(8) utilities. You will only need to look at that if you have some sort of non-standard (or programmable ?) keys on your keyboard.
a mechanism turning keycodes into characters using a keymap. You can access this keymap using the loadkeys(1) and dumpkeys(1) utilities.
The keyboard driver can be in one of 4 modes (which you can access using kbd_mode(1)), which will influence what type of data applications will get as keyboard input:
the scancode (K_RAW) mode, in which the application gets scancodes for input. It is used by applications that implement their own keyboard driver. For example, X11 does that.
the keycode (K_MEDIUMRAW) mode, in which the application gets information on which keys (identified by their keycodes) get pressed and released. AFAIK, no real-life application uses this mode, but it is useful to helper programs like showkey(1) to assist keymap designers.
the ASCII (K_XLATE) mode, in which the application effectively gets the characters as defined by the keymap, using an 8-bit encoding. In this mode, the Ascii_0 to Ascii_9 keymap symbols allow to compose characters by giving their decimal 8bit-code, and Hex_0 to Hex_F do the same with (2-digit) hexadecimal codes.
the Unicode (K_UNICODE) mode, which at this time only differs from the ASCII mode by allowing the user to compose UTF8 unicode characters by their decimal value, using Ascii_0 to Ascii_9 (who needs that ?), or their hexadecimal (4-digit) value, using Hex_0 to Hex_9. A keymap can be set up to produce UTF8 sequences (with a U+XXXX pseudo-symbol, where each X is an hexadecimal digit), but be warned that these UTF8 sequences will also be produced even in ASCII mode. I think this is a bug in the kernel.
BE WARNED that putting the keyboard in RAW or MEDIUMRAW mode will make it unusable for most applications. Use showkey(1) to get a demo of these special modes, or to find out what scancodes/keycodes are produced by a specific key.
keytables(5), setleds(1), setmetamode(1).