1 |
hedin |
54 |
/*********************************************************************
|
2 |
|
|
*
|
3 |
|
|
* MAC Module Defs for Microchip Stack
|
4 |
|
|
*
|
5 |
|
|
*********************************************************************
|
6 |
|
|
* FileName: MAC.h
|
7 |
|
|
* Dependencies: StackTsk.h
|
8 |
|
|
* Processor: PIC18C
|
9 |
|
|
* Complier: MCC18 v1.00.50 or higher
|
10 |
|
|
* HITECH PICC-18 V8.10PL1 or higher
|
11 |
|
|
* Company: Microchip Technology, Inc.
|
12 |
|
|
*
|
13 |
|
|
* Software License Agreement
|
14 |
|
|
*
|
15 |
|
|
* The software supplied herewith by Microchip Technology Incorporated
|
16 |
|
|
* (the “Company”) for its PICmicro® Microcontroller is intended and
|
17 |
|
|
* supplied to you, the Company’s customer, for use solely and
|
18 |
|
|
* exclusively on Microchip PICmicro Microcontroller products. The
|
19 |
|
|
* software is owned by the Company and/or its supplier, and is
|
20 |
|
|
* protected under applicable copyright laws. All rights are reserved.
|
21 |
|
|
* Any use in violation of the foregoing restrictions may subject the
|
22 |
|
|
* user to criminal sanctions under applicable laws, as well as to
|
23 |
|
|
* civil liability for the breach of the terms and conditions of this
|
24 |
|
|
* license.
|
25 |
|
|
*
|
26 |
|
|
* THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
|
27 |
|
|
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
|
28 |
|
|
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
29 |
|
|
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
|
30 |
|
|
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
|
31 |
|
|
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
32 |
|
|
*
|
33 |
|
|
* Author Date Comment
|
34 |
|
|
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
35 |
|
|
* Nilesh Rajbharti 4/27/01 Original (Rev 1.0)
|
36 |
|
|
* Nilesh Rajbharti 11/27/01 Added SLIP
|
37 |
|
|
* Nilesh Rajbharti 2/9/02 Cleanup
|
38 |
|
|
* Nilesh Rajbharti 5/22/02 Rev 2.0 (See version.log for detail)
|
39 |
|
|
********************************************************************/
|
40 |
|
|
|
41 |
|
|
#ifndef MAC_H
|
42 |
|
|
#define MAC_H
|
43 |
|
|
|
44 |
|
|
#include "stacktsk.h"
|
45 |
|
|
|
46 |
|
|
#define MAC_IP (0)
|
47 |
|
|
#define MAC_ARP (0x6)
|
48 |
|
|
#define MAC_UNKNOWN (0x0ff)
|
49 |
|
|
|
50 |
|
|
#define INVALID_BUFFER (0xff)
|
51 |
|
|
|
52 |
|
|
void MACInit(void);
|
53 |
|
|
BOOL MACIsTxReady(void);
|
54 |
|
|
|
55 |
|
|
BOOL MACGetHeader(MAC_ADDR *remote, BYTE* type);
|
56 |
|
|
BYTE MACGet(void);
|
57 |
|
|
WORD MACGetArray(BYTE *val, WORD len);
|
58 |
|
|
void MACDiscardRx(void);
|
59 |
|
|
|
60 |
|
|
void MACPutHeader(MAC_ADDR *remote,
|
61 |
|
|
BYTE type,
|
62 |
|
|
WORD dataLen);
|
63 |
|
|
void MACPut(BYTE val);
|
64 |
|
|
void MACPutArray(BYTE *val, WORD len);
|
65 |
|
|
void MACFlush(void);
|
66 |
|
|
void MACDiscardTx(BUFFER buffer);
|
67 |
|
|
|
68 |
|
|
void MACSetRxBuffer(WORD offset);
|
69 |
|
|
void MACSetTxBuffer(BUFFER buffer, WORD offset);
|
70 |
|
|
void MACReserveTxBuffer(BUFFER buffer);
|
71 |
|
|
|
72 |
|
|
WORD MACGetOffset(void);
|
73 |
|
|
|
74 |
|
|
WORD MACGetFreeRxSize(void);
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
#define MACGetRxBuffer() (NICCurrentRdPtr)
|
78 |
|
|
#define MACGetTxBuffer() (NICCurrentTxBuffer)
|
79 |
|
|
|
80 |
|
|
#if !defined(THIS_IS_MAC_LAYER)
|
81 |
|
|
#if !defined(STACK_USE_SLIP)
|
82 |
|
|
extern BYTE NICCurrentTxBuffer;
|
83 |
|
|
extern BYTE NICCurrentRdPtr;
|
84 |
|
|
#else
|
85 |
|
|
#define NICCurrentTxBuffer (0)
|
86 |
|
|
#define NICCurrentRdPtr (0)
|
87 |
|
|
#endif
|
88 |
|
|
#endif
|
89 |
|
|
|
90 |
|
|
BOOL MACIsLinked(void);
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
#endif
|