Čeština / English
Login

SVN Repository / Prohlížení

Aktuální adresář: FITkit / trunk / mcu / libs / enc28j60 /

enc28j60_spi_tx.h

   1  /*******************************************************************************
   2  
   3     Copyright (C) 2010 Brno University of Technology,
   4                        Faculty of Information Technology
   5     Author(s): Martin Musil <xmusil34 AT fit.vutbr.cz>
   6  
   7     LICENSE TERMS
   8  
   9     Redistribution and use in source and binary forms, with or without
  10     modification, are permitted provided that the following conditions
  11     are met:
  12     1. Redistributions of source code must retain the above copyright
  13        notice, this list of conditions and the following disclaimer.
  14     2. Redistributions in binary form must reproduce the above copyright
  15        notice, this list of conditions and the following disclaimer in
  16        the documentation and/or other materials provided with the
  17        distribution.
  18     3. All advertising materials mentioning features or use of this software
  19        or firmware must display the following acknowledgement:
  20  
  21          This product includes software developed by the University of
  22          Technology, Faculty of Information Technology, Brno and its
  23          contributors.
  24  
  25     4. Neither the name of the Company nor the names of its contributors
  26        may be used to endorse or promote products derived from this
  27        software without specific prior written permission.
  28  
  29     This software or firmware is provided ``as is'', and any express or implied
  30     warranties, including, but not limited to, the implied warranties of
  31     merchantability and fitness for a particular purpose are disclaimed.
  32     In no event shall the company or contributors be liable for any
  33     direct, indirect, incidental, special, exemplary, or consequential
  34     damages (including, but not limited to, procurement of substitute
  35     goods or services; loss of use, data, or profits; or business
  36     interruption) however caused and on any theory of liability, whether
  37     in contract, strict liability, or tort (including negligence or
  38     otherwise) arising in any way out of the use of this software, even
  39     if advised of the possibility of such damage.
  40  
  41     $Id$
  42  
  43  *******************************************************************************/
  44  
  45  /**
  46  	\file enc28j60_spi_tx.h
  47  
  48  */
  49  
  50  #ifndef _ENC28J60_SPI_TX_
  51  #define _ENC28J60_SPI_TX_
  52  
  53  
  54  //protokoly
  55  #define TCP_PROTO   1	///<TCP protokol
  56  #define UDP_PROTO   2	///<UDP protokol
  57  #define ICMP_PROTO	3	///<ICMP protokol
  58  #define ARP_PROTO	4	///<ARP protokol
  59  
  60  /**
  61   \cond
  62   **/
  63  
  64  
  65  #define TCP_PROTO_HEADER_ONLY 5
  66  
  67  //konstanty pro identifikaci hlavicek
  68  
  69  
  70  
  71  
  72  
  73  
  74  
  75  
  76  
  77  
  78  
  79  
  80  
  81  
  82  
  83  
  84  
  85  
  86  
  87  
  88  
  89  
  90  /*
  91  #define TX1ST	0			//zacatek UDP paketu
  92  #define TX1ND	1514		//konec mista pro UDP paket, vynechana mezera 7B pro status vektor
  93  #define TX2ST	1522		//zacatek pomocneho bufferu, pro ARP (a ICMP) dotazy
  94  #define TX2ND	1596		//konec mista pro ARP paket, vynechana mezera 7B pro status vektor
  95  #define TX3ST	1604		//zacatek TCP paketu
  96  #define TX3ND	3118 		//konec mista pro TCP paket
  97  */
  98  
  99  /*
 100  zmena, dodany radic mel obcasne problemy s inicializaci jednoho registru, ERXWRPT,
 101  je pouze pro cteni a inicializuje se automaticky podle hodnoty ERXST, ale obcas
 102  se v nem hodnota ERXST neobjevila, byla tam 0, proto jsem ukazatele zamenil,
 103  aby byla hodnota ERXST a potazmo ERXWRPT 0 a tak i pri teto chybe pracoval radic spravne
 104  */
 105  
 106  
 107  
 108  
 109  
 110  
 111  
 112  
 113  
 114  
 115  
 116  
 117  
 118  //konstanty pro identifikaci aktualniho bufferu
 119  #define TX1	32	///<buffer pro UDP pakety
 120  #define TX2	64	///<buffer pro ICMP
 121  #define TX3	128	///<buffer pro TCP pakety
 122  #define TX4	192	///<buffer pro ARP
 123  
 124  /**
 125   \endcond
 126   **/
 127  
 128  /**
 129  
 130   \param transport_protocol - jedna z konstant \a TCP_PROTO, \a UDP_PROTO a \a ICMP_PROTO
 131  
 132  
 133  
 134  
 135   **/
 136  char tx_init(unsigned char transport_protocol);
 137  
 138  
 139  /**
 140  
 141  
 142   \see tx_skip()
 143   **/
 144  void tx_rewind();
 145  
 146  /**
 147   \cond
 148   **/
 149  
 150  /**
 151  
 152  
 153   **/
 154  void tx_seek(unsigned char header);
 155  
 156  /**
 157   \endcond
 158   **/
 159  
 160  /**
 161  
 162  
 163  
 164   **/
 165  inline void tx_close();
 166  
 167  /**
 168   \cond
 169   **/
 170  
 171  /**
 172  
 173  
 174   \see tx_act()
 175   \see tx_load()
 176   **/
 177  void tx_save(unsigned char buffer);
 178  
 179  /**
 180  
 181  
 182   \see tx_act()
 183   \see tx_save()
 184   **/
 185  void tx_load(unsigned char buffer);
 186  
 187  /**
 188  
 189   \returns jedna z konstant \a TX1, \a TX2 a \a TX3
 190   **/
 191  unsigned char tx_act();
 192  
 193  /**
 194   \endcond
 195   **/
 196  
 197  /**
 198  
 199  
 200  
 201  
 202   \see tx_write()
 203   \see tx_write_str()
 204   **/
 205  unsigned char tx_putc(char c);
 206  
 207  /**
 208  
 209   \param ptr - ukazatel na data
 210  
 211  
 212   \see tx_putc()
 213   \see tx_write_str()
 214   **/
 215  unsigned int tx_write(void* ptr, unsigned int length);
 216  
 217  /**
 218  
 219  
 220  
 221   \see tx_putc()
 222   \see tx_write()
 223   **/
 224  #define tx_write_str(str) tx_write(str,enc_strlen(str))
 225  
 226  /**
 227  
 228  
 229  
 230  
 231   **/
 232  unsigned int tx_skip(unsigned int length);
 233  
 234  /**
 235  
 236  
 237  
 238  
 239   **/
 240  unsigned int tx_fill(unsigned char value, unsigned int length);
 241  
 242  /**
 243   \cond
 244   **/
 245  
 246  /**
 247  
 248  
 249  
 250   **/
 251  char tx_send();
 252  
 253  /**
 254   \endcond
 255   **/
 256  
 257  /**
 258  
 259  
 260   **/
 261  inline unsigned int tx_left();
 262  
 263  /**
 264   \cond
 265   **/
 266  
 267  /**
 268  
 269  
 270   **/
 271  inline unsigned int tx_data_len();
 272  
 273  /**
 274  
 275   \returns checksum
 276   **/
 277  unsigned int tx_checksum();
 278  
 279  /**
 280  
 281  
 282   **/
 283  inline void tx_unlock(unsigned char buffer);
 284  
 285  /**
 286   \endcond
 287   **/
 288  
 289  #endif /*_ENC28J60_SPI_TX_*/
 290  
Zobrazeno: 683841x Naposledy: 5.7.2022 05:03:43