Statistics
| Branch: | Tag: | Revision:

mongoose / examples / PIC32 / http_server / firmware / src / app.h @ eaef5bd1

History | View | Annotate | Download (6.58 KB)

1
/* clang-format off */
2
/*******************************************************************************
3
  MPLAB Harmony Application Header File
4

5
  Company:
6
    Microchip Technology Inc.
7

8
  File Name:
9
    app.h
10

11
  Summary:
12
    This header file provides prototypes and definitions for the application.
13

14
  Description:
15
    This header file provides function prototypes and data type definitions for
16
    the application.  Some of these are required by the system (such as the
17
    "APP_Initialize" and "APP_Tasks" prototypes) and some of them are only used
18
    internally by the application (such as the "APP_STATES" definition).  Both
19
    are defined here for convenience.
20
*******************************************************************************/
21

    
22
//DOM-IGNORE-BEGIN
23
/*******************************************************************************
24
Copyright (c) 2013-2014 released Microchip Technology Inc.  All rights reserved.
25

26
Microchip licenses to you the right to use, modify, copy and distribute
27
Software only when embedded on a Microchip microcontroller or digital signal
28
controller that is integrated into your product or third party product
29
(pursuant to the sublicense terms in the accompanying license agreement).
30

31
You should refer to the license agreement accompanying this Software for
32
additional information regarding your rights and obligations.
33

34
SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
35
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
36
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
37
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
38
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
39
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
40
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
41
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
42
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
43
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
44
 *******************************************************************************/
45
//DOM-IGNORE-END
46

    
47
#ifndef _APP_H
48
#define _APP_H
49

    
50

    
51
// *****************************************************************************
52
// *****************************************************************************
53
// Section: Included Files
54
// *****************************************************************************
55
// *****************************************************************************
56

    
57
#include <stdint.h>
58
#include <stdbool.h>
59
#include <stddef.h>
60
#include <stdlib.h>
61
#include "system_config.h"
62
#include "system_definitions.h"
63

    
64
// *****************************************************************************
65
// *****************************************************************************
66
// Section: Type Definitions
67
// *****************************************************************************
68
// *****************************************************************************
69

    
70
// *****************************************************************************
71
/* Application States
72

73
  Summary:
74
    Application states enumeration
75

76
  Description:
77
    This enumeration defines the valid application states.  These states
78
    determine the behavior of the application at various times.
79
*/
80

    
81
typedef enum
82
{
83
        /* Application's state machine's initial state. */
84
        APP_STATE_INIT=0,
85

    
86
    APP_TCPIP_WAIT_FOR_IP,
87

    
88
    APP_START_LISTENING,
89

    
90
    APP_DONE,
91

    
92
    APP_EMPTY,
93

    
94
    APP_POLL
95
} APP_STATES;
96

    
97

    
98
// *****************************************************************************
99
/* Application Data
100

101
  Summary:
102
    Holds application data
103

104
  Description:
105
    This structure holds the application's data.
106

107
  Remarks:
108
    Application strings and buffers are be defined outside this structure.
109
 */
110

    
111
typedef struct
112
{
113
    /* The application's current state */
114
    APP_STATES state;
115

    
116
    /* TODO: Define any additional data used by the application. */
117
    TCP_SOCKET              socket;
118

    
119
    char *            host;
120

    
121
    char *            path;
122
    uint16_t          port;
123

    
124
} APP_DATA;
125

    
126

    
127
// *****************************************************************************
128
// *****************************************************************************
129
// Section: Application Callback Routines
130
// *****************************************************************************
131
// *****************************************************************************
132
/* These routines are called by drivers when certain events occur.
133
*/
134

    
135

    
136
// *****************************************************************************
137
// *****************************************************************************
138
// Section: Application Initialization and State Machine Functions
139
// *****************************************************************************
140
// *****************************************************************************
141

    
142
/*******************************************************************************
143
  Function:
144
    void APP_Initialize ( void )
145

146
  Summary:
147
     MPLAB Harmony application initialization routine.
148

149
  Description:
150
    This function initializes the Harmony application.  It places the
151
    application in its initial state and prepares it to run so that its
152
    APP_Tasks function can be called.
153

154
  Precondition:
155
    All other system initialization routines should be called before calling
156
    this routine (in "SYS_Initialize").
157

158
  Parameters:
159
    None.
160

161
  Returns:
162
    None.
163

164
  Example:
165
    <code>
166
    APP_Initialize();
167
    </code>
168

169
  Remarks:
170
    This routine must be called from the SYS_Initialize function.
171
*/
172

    
173
void APP_Initialize ( void );
174

    
175

    
176
/*******************************************************************************
177
  Function:
178
    void APP_Tasks ( void )
179

180
  Summary:
181
    MPLAB Harmony Demo application tasks function
182

183
  Description:
184
    This routine is the Harmony Demo application's tasks function.  It
185
    defines the application's state machine and core logic.
186

187
  Precondition:
188
    The system and application initialization ("SYS_Initialize") should be
189
    called before calling this.
190

191
  Parameters:
192
    None.
193

194
  Returns:
195
    None.
196

197
  Example:
198
    <code>
199
    APP_Tasks();
200
    </code>
201

202
  Remarks:
203
    This routine must be called from SYS_Tasks() routine.
204
 */
205

    
206
void APP_Tasks ( void );
207

    
208

    
209
#endif /* _APP_H */
210
/*******************************************************************************
211
 End of File
212
 */
213