# SFBConstants.h

Go to the documentation of this file.

    00001 /*                                             -*- mode:C++; fill-column:100 -*-
    00002   SFBConstants.h - Names for SFB constants
    00003   Copyright (C) 2008 The Regents of the University of New Mexico.  All rights reserved.
    00004
    00005   This library is free software; you can redistribute it and/or
    00006   modify it under the terms of the GNU Lesser General Public
    00007   License as published by the Free Software Foundation; either
    00008   version 2.1 of the License, or (at your option) any later version.
    00009
    00010   This library is distributed in the hope that it will be useful,
    00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013   Lesser General Public License for more details.
    00014
    00015   You should have received a copy of the GNU General Public License
    00016   along with this library; if not, write to the Free Software
    00017   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
    00018   USA
    00019 */
    00020
    00027 #ifndef SFBCONSTANTS_H_
    00028 #define SFBCONSTANTS_H_
    00029
    00030 #include "SFBTypes.h"
    00031 #include "SFBMacros.h"
    00032
    00035 #define HIGH 1
    00036 #define LOW 0
    00038
    00039
    00041 #define DEC 10
    00042 #define HEX 16
    00043 #define OCT 8
    00044 #define BIN 2
    00045 #define BYTE 0
    00047 #define BESHORT -1
    00048 #define BELONG -2
    00049 #define B36 36
    00051
    00052
    00054 #define INPUT  0
    00055 #define OUTPUT 1
    00056 #define REFLEX_MODE 2
    00057 #define HW_MODE 3
    00059
    00060
    00063 #define NORTH  0u
    00064 #define SOUTH  1u
    00065 #define EAST   2u
    00066 #define WEST   3u
    00089 #define FACE_COUNT 4
    00090
    00096 #define SPINE 4u
    00097 #define WMEM  5u
    00098 #define BRAIN 6u
    00100 #define ALL_FACES 7u
    00102 #define NO_FACES 8u
    00105 #define MIN_VIRTUAL_FACE 9u
    00108 #define VIRTUAL_FACE_COUNT 32
    00114 #define MAX_FACE_INDEX (MIN_VIRTUAL_FACE+VIRTUAL_FACE_COUNT)
    00120 #define NOT_A_FACE (MAX_FACE_INDEX)
    00123
    00124
    00127 #define RISING  0x01
    00128 #define FALLING 0x02
    00129 #define CHANGING ((RISING)|(FALLING))
    00131
    00132
    00135 #define LSBFIRST 0
    00136 #define MSBFIRST 1
    00138
    00139
    00141 #define UNKNOWN_BOOT_MODE 0
    00142 #define RED_BOOT_MODE 1
    00143 #define GREEN_BOOT_MODE 2
    00144 #define BLUE_BOOT_MODE 3
    00145 #define MAX_BOOT_MODES 4
    00147
    00148
    00153 #define PK_DELETED    0x01
    00154 #define PK_OVERRUN    0x02
    00155 #define PK_PARITY     0x04
    00156 #define PK_FRAMING    0x08
    00157 #define PK_BREAK      0x10
    00158 #define PK_BUFFER     0x20
    00159 #define PK_BAD_ESCAPE 0x40
    00160 #define PK_RESERVED8  0x80
    00164 #define PK_BYTE_ERROR (PK_OVERRUN|PK_PARITY|PK_FRAMING|PK_BREAK)
    00166 #define PK_PACKET_ERROR (PK_BUFFER|PK_BAD_ESCAPE)
    00168 #define PK_BROKEN (PK_PACKET_ERROR|PK_BYTE_ERROR)
    00171
    00172
    00266 #define MAX_PACKET_LENGTH 252
    00267
    00274 #define SINGLE_PACKET_BUFFER_SIZE_WORDS (((MAX_PACKET_LENGTH)>>2)+1)
    00275 #define SINGLE_PACKET_BUFFER_SIZE_BYTES (SINGLE_PACKET_BUFFER_SIZE_WORDS<<2)
    00276
    00277 #define BYTE_BUFFER_BITS 10   /* 1024 bytes.  Big enough for two worst-case escaped packet (though
    00278                                 that's not strictly required, since we deframe incrementally). */
    00279 #define BYTE_BUFFER_BYTES (1<<BYTE_BUFFER_BITS)
    00280
    00281 #define BYTE_BUFFER_MASK (BYTE_BUFFER_BYTES-1)
    00282
    00283
    00286 #endif /*SFBCONSTANTS_H_*/