forked from fenugrec/npkern
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split things into mfg-specific files for - wdt pin management - "special needs" like subaru FWE pin
- Loading branch information
Showing
10 changed files
with
206 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef MFG_H | ||
#define MFG_H | ||
|
||
/** defs for manufacturer-specific stuff */ | ||
|
||
|
||
/** Called before init_platf. | ||
* This is manufacturer-specific, and implemented in a separate .c file | ||
*/ | ||
void init_mfg(void); | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* external WDT functions specific to Nissan ECUs | ||
* | ||
* (c) fenugrec 2022 | ||
* GPLv3 | ||
* | ||
*/ | ||
|
||
#include <stdint.h> | ||
|
||
#include "mfg.h" | ||
#include "platf.h" | ||
#include "stypes.h" | ||
#include "wdt.h" | ||
|
||
|
||
/**** "preload" info struct filled before calling RAMjump. This probably varies but seems typical ? *****/ | ||
struct rj_preload { | ||
uint16_t flag0; // ? | ||
uint16_t wdt_pin; // pin # mask for PxDR | ||
uint16_t s36k2_H; | ||
uint16_t s36k2_L; | ||
uint16_t wdt_portH; //&PxDR>>16 | ||
uint16_t wdt_portL; //&PxDR & 0xFFFF | ||
}; | ||
|
||
|
||
/** parse "preload" info | ||
*/ | ||
void init_mfg(void) { | ||
struct rj_preload *rjp = (struct rj_preload *)RAMJUMP_PRELOAD_META; | ||
/* get pin info */ | ||
wdt_dr = (u16 *) ((rjp->wdt_portH << 16) | (rjp->wdt_portL)); | ||
wdt_pin = rjp->wdt_pin; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* functions specific to Subaru ECUs | ||
* | ||
* (c) fenugrec 2022 | ||
* (c) rimwall 2022 | ||
* GPLv3 | ||
* | ||
*/ | ||
|
||
#include <stdint.h> | ||
|
||
#include "mfg.h" | ||
#include "platf.h" | ||
#include "wdt.h" | ||
|
||
|
||
|
||
void init_mfg(void) { | ||
wdt_dr = &PB.DR.WORD; //manually assign these values, not elegant but will do for now | ||
wdt_pin = 0x8000; | ||
|
||
// set PD8 to bring FWE high to prepare for erasing or flashing | ||
PD.DR.WORD |= 0x0100; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.