PIC32 BootLoader
system.h
Go to the documentation of this file.
1 /*
2  * The MIT License
3  *
4  * Copyright(c) 2016 Mallikarjun Tirlapur.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 
32 #ifndef SYSTEM_H
33 #define SYSTEM_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 //#include <xc.h>
39 #include <p32xxxx.h>
40 #include <string.h>
41 #include <stdlib.h>
42 #include <sys/attribs.h>
43 
44 typedef unsigned char uint8_t;
45 typedef unsigned short uint16_t;
46 typedef unsigned long uint32_t;
47 typedef unsigned int uint_t;
48 
49 #define NVM_PAGE_SIZE 1024 // # of 32-bit Instructions per Page
50 #define BYTE_PAGE_SIZE (4 * PAGE_SIZE) // Page size in Bytes
51 #define ROW_SIZE 128 // # of 32-bit Instructions per Row
52 #define BYTE_ROW_SIZE (4 * ROW_SIZE) // # Row size in Bytes
53 #define NUM_ROWS_PAGE 8 //Number of Rows per Page
54 
55 #define APP_FLASH_BASE_ADDRESS 0x9D006000
56 #define APP_FLASH_END_ADDRES 0x9D00FFFF
58 uint32_t applStartAdd;
60 void runStateMachine(void);
61 
62 void initVarConfigPort(void);
63 
64 void runApplcn(void);
65 
71 typedef enum SYSTEM_STATUS_Tag {
78 } SYS_STATE_t;
79 
92 
93 
94 
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif /* SYSTEM_H */
101 
SYSTEM_COM_PROTOCOL_MSG_Tag
Enumeral represents handshaking signals between programmer and controller.
Definition: system.h:83
Definition: system.h:89
Definition: system.h:90
SYSTEM_STATUS_Tag
Enumeral represents different system states.
Definition: system.h:71
Definition: system.h:76
Definition: system.h:75
Definition: system.h:88
Definition: system.h:74
Definition: system.h:87
void runApplcn(void)
PC is updated with the new pointer to execute loaded binary from the application flash program memory...
Definition: main.c:89
Definition: system.h:86
Definition: system.h:73
Definition: system.h:85
Definition: system.h:72
enum SYSTEM_COM_PROTOCOL_MSG_Tag SYS_COM_PROTOCL_MSG_t
Enumeral represents handshaking signals between programmer and controller.
enum SYSTEM_STATUS_Tag SYS_STATE_t
Enumeral represents different system states.
Definition: system.h:84
uint8_t totalNumberOfPacckets
Definition: system.h:66
Definition: system.h:77