Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /********************************************************************* |
2 | * |
||
3 | * Tick Manager for PIC18 |
||
4 | * |
||
5 | ********************************************************************* |
||
6 | * FileName: Tick.h |
||
7 | * Dependencies: None |
||
8 | * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32 |
||
9 | * Compiler: Microchip C32 v1.05 or higher |
||
10 | * Microchip C30 v3.12 or higher |
||
11 | * Microchip C18 v3.30 or higher |
||
12 | * HI-TECH PICC-18 PRO 9.63PL2 or higher |
||
13 | * Company: Microchip Technology, Inc. |
||
14 | * |
||
15 | * Software License Agreement |
||
16 | * |
||
17 | * Copyright (C) 2002-2009 Microchip Technology Inc. All rights |
||
18 | * reserved. |
||
19 | * |
||
20 | * Microchip licenses to you the right to use, modify, copy, and |
||
21 | * distribute: |
||
22 | * (i) the Software when embedded on a Microchip microcontroller or |
||
23 | * digital signal controller product ("Device") which is |
||
24 | * integrated into Licensee's product; or |
||
25 | * (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h, |
||
26 | * ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device |
||
27 | * used in conjunction with a Microchip ethernet controller for |
||
28 | * the sole purpose of interfacing with the ethernet controller. |
||
29 | * |
||
30 | * You should refer to the license agreement accompanying this |
||
31 | * Software for additional information regarding your rights and |
||
32 | * obligations. |
||
33 | * |
||
34 | * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT |
||
35 | * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT |
||
36 | * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A |
||
37 | * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
||
38 | * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR |
||
39 | * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF |
||
40 | * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS |
||
41 | * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE |
||
42 | * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER |
||
43 | * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT |
||
44 | * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE. |
||
45 | * |
||
46 | * |
||
47 | * Author Date Comment |
||
48 | *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
49 | * Nilesh Rajbharti 6/28/01 Original (Rev 1.0) |
||
50 | * Nilesh Rajbharti 2/9/02 Cleanup |
||
51 | * Nilesh Rajbharti 5/22/02 Rev 2.0 (See version.log for detail) |
||
52 | ********************************************************************/ |
||
53 | #ifndef __TICK_H |
||
54 | #define __TICK_H |
||
55 | |||
56 | #include "TCPIP Stack/TCPIP.h" |
||
57 | |||
58 | // All TICKS are stored as 32-bit unsigned integers. |
||
59 | // This is deprecated since it conflicts with other TICK definitions used in |
||
60 | // other Microchip software libraries and therefore poses a merge and maintence |
||
61 | // problem. Instead of using the TICK data type, just use the base DWORD data |
||
62 | // type instead. |
||
63 | typedef __attribute__((__deprecated__)) DWORD TICK; |
||
64 | |||
65 | // This value is used by TCP and other modules to implement timeout actions. |
||
66 | // For this definition, the Timer must be initialized to use a 1:256 prescalar |
||
67 | // in Tick.c. If using a 32kHz watch crystal as the time base, modify the |
||
68 | // Tick.c file to use no prescalar. |
||
69 | #define TICKS_PER_SECOND ((GetPeripheralClock()+128ull)/256ull) // Internal core clock drives timer with 1:256 prescaler |
||
70 | //#define TICKS_PER_SECOND (32768ul) // 32kHz crystal drives timer with no scalar |
||
71 | |||
72 | // Represents one second in Ticks |
||
73 | #define TICK_SECOND ((QWORD)TICKS_PER_SECOND) |
||
74 | // Represents one minute in Ticks |
||
75 | #define TICK_MINUTE ((QWORD)TICKS_PER_SECOND*60ull) |
||
76 | // Represents one hour in Ticks |
||
77 | #define TICK_HOUR ((QWORD)TICKS_PER_SECOND*3600ull) |
||
78 | |||
79 | |||
80 | void TickInit(void); |
||
81 | DWORD TickGet(void); |
||
82 | DWORD TickGetDiv256(void); |
||
83 | DWORD TickGetDiv64K(void); |
||
84 | DWORD TickConvertToMilliseconds(DWORD dwTickValue); |
||
85 | void TickUpdate(void); |
||
86 | |||
87 | #endif |
Powered by WebSVN v2.8.3