USB-BDI
M:/USB-BDI/USB-BDI/Firmware/MPC555-USB-BDI/include/usbpdi_main.h
Go to the documentation of this file.
00001 /*      USB-BDI Used for programming and debugging a MPC555 over USB
00002  * 
00003  *  Copyright 2005 NTB Interstate University of Applied Sciences of Technology Buchs
00004  *
00005  *  This program is free software: you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation, either version 3 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program 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
00013  *  GNU General Public License for more details.
00014  */
00015 
00024 #ifndef USBPDI_MAIN_H_
00025 #define USBPDI_MAIN_H_
00026 
00027 #include "fx2regs.h"
00028 #include "syncdelay.h"
00029 #include "dispatch.h"
00030 
00031 // Packet definitions
00032 /* A packet consist of a 1 byte header, a 2 byte type-field (Main-, Subtype), 
00033  * a 2 byte length-field (only payload), x bytes payload and a 1 byte packet-end-field
00034  */
00036 #define PACKET_HEADER 0x5B
00037 
00038 #define PACKET_END 0x1F
00039 
00040 #define PACKET_DATA_OFFSET 5
00041 
00042 #define PACKET_MIN_LENGTH 6
00043 
00044 // USB buffer definitions
00046 #define usbOutBuffer EP2FIFOBUF
00047 
00048 #define usbInBuffer EP6FIFOBUF
00049 
00051 #define STATUS_LED_COUNT_LIMIT  0x80
00052 
00054 //#define DEBUG_ON
00055 
00056 #ifdef DEBUG_ON
00057 void write(unsigned char digit);
00058 #endif
00059 
00060 extern unsigned short outBufIndex;      // current location of OUTBUFFER
00061 extern unsigned short inBufIndex;       // current location of INBUFFER
00062 
00063 void sendPacket(unsigned short length);
00064 
00065 #endif /*USBPDI_MAIN_H_*/
 All Files Functions Variables Defines