00001 /****************************************************************************** 00002 ** Copyright (C) 2007 Pablo Garcia 00003 ** 00004 ** This library is free software; you can redistribute it and/or 00005 ** modify it under the terms of the GNU Lesser General Public 00006 ** License as published by the Free Software Foundation; either 00007 ** version 2.1 of the License, or (at your option) any later version. 00008 00009 ** This library is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 ** Lesser General Public License for more details. 00013 00014 ** You should have received a copy of the GNU Lesser General Public 00015 ** License along with this library; if not, write to the Free Software 00016 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00017 ******************************************************************************/ 00018 00030 /* protocolo (mensajes al dsp): 00031 msg: |"WVAR"|dir|val| --> escribir variable en la dirección dir con el valor val 00032 msg: |"RVAR"|dir| --> leer variable en la dirección dir 00033 msg: |"CVAR"|dir| --> tiempo real para variable en la dirección dir 00034 00035 Cuando una variable se establece de tiempo real, se introduce una entrada en la tabla rtVariables con el campo 00036 used = 1 y el campo dir = dir 00037 00038 protocolo (mensajes del dsp): 00039 |"WACK"|dir|val| --> respuesta tras peticion de escritura de variable 00040 |"CACK"|dir|0x0000| --> respuesta tras peticion de lectura de variable en tiempo real 00041 |"RVAR"|dir|val| --> valor (val) de la variable en la posicion dir 00042 00043 1) LECTURA VARIABLE: 00044 00045 remote dsp 00046 00047 |"RVAR"|dir| --> 00048 <-- |"RACK"|dir|val| 00049 00050 1) ESCRITURA VARIABLE: 00051 00052 remote dsp 00053 00054 |"WVAR"|dir|val|--> 00055 <-- |"WACK"|dir|val| 00056 00057 3) LECTURA TIEMPO REAL: 00058 00059 remote dsp 00060 00061 |"CVAR"|dir| --> 00062 <-- |"CACK"|dir|0x0000| 00063 00064 <-- |"RVAR"|dir|val| 00065 . 00066 . 00067 . 00068 <-- |"RVAR"|dir|val| 00069 00070 */ 00071 00072 //----------------------------------------------------------------------------- 00073 // Define 00074 //----------------------------------------------------------------------------- 00075 00076 #ifndef TICOMM_H 00077 #define TICOMM_H 00078 00079 // ---------------------------------------------------------------------------- 00080 // Includes 00081 // ---------------------------------------------------------------------------- 00082 #include "TIMotorLIB.h" 00083 #include GENERATE_FLEX_INC(Device.h) 00084 00085 00086 typedef struct MsgStruct 00087 { 00088 char command[2]; 00089 Uint32 dir; 00090 Uint32 val; 00091 } msgStruct; 00092 00093 union Msg 00094 { 00095 volatile char raw[6]; 00096 volatile msgStruct data; 00097 }; 00098 00099 typedef struct RTMsgStruct 00100 { 00101 char command[2]; 00102 Uint32 val; 00103 } rtMsgStruct; 00104 00105 union RTMsg 00106 { 00107 volatile char raw[4]; 00108 volatile rtMsgStruct data; 00109 }; 00110 00111 #define MAX_ACCSESIBLE_VARS 16 00112 struct RTVariables{ 00113 unsigned char used; 00114 unsigned char pos; 00115 Uint32* dir; 00116 }; 00117 00118 extern volatile unsigned char RTMonitorStart; 00119 00120 void InitTIComm(unsigned char isrMonitor); 00121 char TICommProtocol(volatile char sciaRXDT, volatile union Msg* dspMsg); 00122 interrupt void SCIARxInterrupt(void); 00123 interrupt void SCIATxInterrupt(void); 00124 void RTMonitor(void); 00125 00126 00127 00128 #endif 00129 00130 //----------------------------------------------------------------------------- 00131 // End Of File 00132 //----------------------------------------------------------------------------- 00133