OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [mw/] [src/] [drivers/] [mou_ser.c] - Diff between revs 716 and 770

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 716 Rev 770
Line 119... Line 119...
#else
#else
        NULL
        NULL
#endif
#endif
};
};
 
 
 
extern void _print(char *, ...);
/*
/*
 * Open up the mouse device.
 * Open up the mouse device.
 * Returns the fd if successful, or negative if unsuccessful.
 * Returns the fd if successful, or negative if unsuccessful.
 */
 */
static int
static int
Line 207... Line 208...
        termios.c_cflag |= B1200;
        termios.c_cflag |= B1200;
#endif
#endif
        termios.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN | ISIG);
        termios.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN | ISIG);
        termios.c_iflag &= ~(ICRNL | INPCK | ISTRIP | IXON | BRKINT | IGNBRK);
        termios.c_iflag &= ~(ICRNL | INPCK | ISTRIP | IXON | BRKINT | IGNBRK);
        termios.c_cflag &= ~(CSIZE | PARENB);
        termios.c_cflag &= ~(CSIZE | PARENB);
        termios.c_cflag |= CS8;
        termios.c_cflag |= CS7;
        termios.c_cc[VMIN] = 0;
        termios.c_cc[VMIN] = 0;
        termios.c_cc[VTIME] = 0;
        termios.c_cc[VTIME] = 0;
 
 
        tcsetattr(mouse_fd, TCSAFLUSH, &termios);
        tcsetattr(mouse_fd, TCSAFLUSH, &termios);
#endif /* TERMIOS*/
#endif /* TERMIOS*/
Line 323... Line 324...
static int
static int
ParsePC(int byte)
ParsePC(int byte)
{
{
        int     sign;                   /* sign of movement */
        int     sign;                   /* sign of movement */
 
 
 
_print("ParsePS2: %.2x\n", byte);
        switch (state) {
        switch (state) {
                case IDLE:
                case IDLE:
                        if ((byte & TOP_FIVE_BITS) == TOP_BIT) {
                        if ((byte & TOP_FIVE_BITS) == TOP_BIT) {
                                buttons = ~byte & BOTTOM_THREE_BITS;
                                buttons = ~byte & BOTTOM_THREE_BITS;
                                state = XSET;
                                state = XSET;
Line 382... Line 384...
 * Returns nonzero when a new mouse state has been completed.
 * Returns nonzero when a new mouse state has been completed.
 */
 */
static int
static int
ParseMS(int byte)
ParseMS(int byte)
{
{
 
_print("ParseMS: %.2x\n", byte);
        switch (state) {
        switch (state) {
                case IDLE:
                case IDLE:
                        if (byte & SIXTH_BIT) {
                        if (byte & SIXTH_BIT) {
                                buttons = (byte >> 4) & BOTTOM_TWO_BITS;
                                buttons = (byte >> 4) & BOTTOM_TWO_BITS;
                                yd = ((byte & THIRD_FOURTH_BITS) << 4);
                                yd = ((byte & THIRD_FOURTH_BITS) << 4);
Line 416... Line 419...
 * Returns nonzero when a new mouse state has been completed.
 * Returns nonzero when a new mouse state has been completed.
 */
 */
static int
static int
ParsePS2(int byte)
ParsePS2(int byte)
{
{
 
_print("ParsePS2: %.2x\n", byte);
        switch (state) {
        switch (state) {
                case IDLE:
                case IDLE:
                        if (byte & PS2_CTRL_BYTE) {
                        if (byte & PS2_CTRL_BYTE) {
                                buttons = byte &
                                buttons = byte &
                                        (PS2_LEFT_BUTTON|PS2_RIGHT_BUTTON);
                                        (PS2_LEFT_BUTTON|PS2_RIGHT_BUTTON);

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.