1 /* FreeEMS - the open source engine management system
3 * Copyright 2010 Fred Cooke
5 * This file is part of the FreeEMS project.
7 * FreeEMS software is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * FreeEMS software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with any FreeEMS software. If not, see http://www.gnu.org/licenses/
20 * We ask that if you make any changes to this file you email them upstream to
21 * us at admin(at)diyefi(dot)org or, even better, fork the code on github.com!
23 * Thank you for choosing FreeEMS to run your engine!
29 * @ingroup xgateHeaders
31 * @brief C header for assembly xgate functions
33 * Because we need to call the assembly flash burning function from C code an
34 * extern function declaration is required to allow successful compilation.
38 #ifndef FILE_XGATEVECTORS_H_SEEN
39 #define FILE_XGATEVECTORS_H_SEEN
43 #warning "EXTERN already defined by another header, please sort it out!"
44 #undef EXTERN /* If fail on warning is off, remove the definition such that we can redefine correctly. */
54 #define START_OF_FLASH_WINDOW (unsigned short*)0x8000 /* 16KB long */
55 #define START_OF_RAM_WINDOW (unsigned short*)0x1000 /* 4KB long */
56 #define XGATE_RAM_ALLOCATION_SIZE 0x0200 /* 512Bytes */
57 #define RPAGE_TUNE_TWO_WINDOW_DIFFERENCE (0x8000) /*xgate RPAGE2 starts at 0x9000 but the s12 window starts at 0x10000 */
58 #define XGATE_INTERRUPT 0x80
59 #define PRIORITY_LEVEL_ONE 0x01
61 #define ROUTE_INTERRUPT(channel_id, cpu_assignment, priority) \
62 INT_CFADDR = (channel_id * 2) & 0xF0; \
63 INT_CFDATA_ARR[((channel_id * 2) & 0x0F) >> 1] = (cpu_assignment | priority);
66 unsigned short programCounterValue
; /* This data is forced into the XGATE PC register */
67 unsigned short initialVariable
; /* This data is forced into the XGATE R1 register */
70 // This statement imports the symbol from the xgate ASM for use in the vector table
72 void xgatePITTurnOff();
73 void xgatePITTurnOn();
74 void xgateDelayCounter();
75 void startXGATECode();
77 void parameterGuard(); /* counter that gets update when a write to shared RAM begins and again when the write is complete */
79 EXTERN
const xgateIntVector xgateIntVectorTable
[121];
82 // Xgate control value
83 #define XGATE_ERROR_HANDLER 0x0000 /* TODO Create the XGATE error handling thread in asm. */
87 /* let us know if we are being untidy with headers */
88 #warning "Header file XGATEVECTORS_H seen before, sort it out!"
89 /* end of the wrapper ifdef from the very top */