nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /***************************************************************************
2 * *
3 * ########### ########### ########## ########## *
4 * ############ ############ ############ ############ *
5 * ## ## ## ## ## ## ## *
6 * ## ## ## ## ## ## ## *
7 * ########### #### ###### ## ## ## ## ###### *
8 * ########### #### # ## ## ## ## # # *
9 * ## ## ###### ## ## ## ## # # *
10 * ## ## # ## ## ## ## # # *
11 * ############ ##### ###### ## ## ## ##### ###### *
12 * ########### ########### ## ## ## ########## *
13 * *
14 * S E C U R E M O B I L E N E T W O R K I N G *
15 * *
16 * This file is part of NexMon. *
17 * *
18 * Copyright (c) 2016 NexMon Team *
19 * *
20 * NexMon is free software: you can redistribute it and/or modify *
21 * it under the terms of the GNU General Public License as published by *
22 * the Free Software Foundation, either version 3 of the License, or *
23 * (at your option) any later version. *
24 * *
25 * NexMon is distributed in the hope that it will be useful, *
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
28 * GNU General Public License for more details. *
29 * *
30 * You should have received a copy of the GNU General Public License *
31 * along with NexMon. If not, see <http://www.gnu.org/licenses/>. *
32 * *
33 **************************************************************************/
34  
35 #pragma NEXMON targetregion "patch"
36  
37 #include <firmware_version.h> // definition of firmware version macros
38 #include <debug.h> // contains macros to access the debug hardware
39 #include <wrapper.h> // wrapper definitions for functions that already exist in the firmware
40 #include <structs.h> // structures that are used by the code in the firmware
41 #include <helper.h> // useful helper functions
42 #include <patcher.h> // macros used to craete patches such as BLPatch, BPatch, ...
43 #include <rates.h> // rates used to build the ratespec for frame injection
44 #include <local_wrapper.h>
45  
46 unsigned int fp_orig_data[183][2] = { 0 };
47 unsigned int fp_orig_data_len = 183;
48  
49 struct fp_config {
50 unsigned int *target_addr;
51 unsigned int size;
52 unsigned int data_ptr;
53 };
54  
55 int
56 fp_apply_patches_hook(void)
57 {
58 struct fp_config *fpc = (struct fp_config *) 0x1B1800;
59 int i;
60  
61 for (i = 0; i < fp_orig_data_len; i++) {
62 fp_orig_data[i][0] = (unsigned int) (fpc)->target_addr;
63 fp_orig_data[i][1] = *((fpc++)->target_addr);
64 }
65  
66 return fp_apply_patches();
67 }
68  
69 // Hook call to fp_apply_patches in c_main
70 __attribute__((at(0x1bc51a, "", CHIP_VER_BCM43451b1, FW_VER_7_63_43_0)))
71 BLPatch(fp_apply_patches, fp_apply_patches_hook);