Subversion Repositories HomeAutomation

Rev

Rev 339 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 339 Rev 342
Line 2... Line 2...
2
 *
2
 *
3
 *                  Main application
3
 *                  Main application
4
 *
4
 *
5
 *********************************************************************
5
 *********************************************************************
6
 * FileName:        $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canBoot/Source/Main.c $
6
 * FileName:        $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canBoot/Source/Main.c $
7
 * Last changed:    $LastChangedDate: 2007-02-25 20:51:08 +0100 (Sun, 25 Feb 2007) $
7
 * Last changed:    $LastChangedDate: 2007-02-26 21:38:37 +0100 (Mon, 26 Feb 2007) $
8
 * By:              $LastChangedBy: johboh $
8
 * By:              $LastChangedBy: johboh $
9
 * Revision:        $Revision: 339 $
9
 * Revision:        $Revision: 342 $
10
 ********************************************************************/
10
 ********************************************************************/
11
 
11
 
12
#include <compiler.h>
12
#include <compiler.h>
13
#include <stackTasks.h>
13
#include <stackTasks.h>
14
#include <CANdefs.h>
14
#include <CANdefs.h>
Line 32... Line 32...
32
{
32
{
33
    _asm goto RM_LOW_INTERRUPT_VECTOR _endasm
33
    _asm goto RM_LOW_INTERRUPT_VECTOR _endasm
34
}
34
}
35
 
35
 
36
#pragma code
36
#pragma code
37
 
-
 
38
 
37
 
39
 
38
 
40
static CAN_PACKET cp;
39
static CAN_PACKET cp;
41
static DWORD cnt =0;
40
static DWORD cnt =0;
42
 
41
 
Line 91... Line 90...
91
 
90
 
92
    // Send bootloader startup
91
    // Send bootloader startup
93
    outCp.type=ptPGM;
92
    outCp.type=ptPGM;
94
    outCp.pgm.class=pcCTRL;
93
    outCp.pgm.class=pcCTRL;
95
    outCp.pgm.id=pctBOOTBOOT;
94
    outCp.pgm.id=pctBOOTBOOT;
96
    outCp.length=1;
95
    outCp.length=3;
97
    outCp.data[0] = (isBOR()<<7)+(isLVD()<<6)+(isMCLR()<<5)+(isPOR()<<4)+(isWDTTO()<<3)+(isWDTWU()<<2)+(isWU()<<1);
96
    outCp.data[2] = (isBOR()<<7)+(isLVD()<<6)+(isMCLR()<<5)+(isPOR()<<4)+(isWDTTO()<<3)+(isWDTWU()<<2)+(isWU()<<1);
-
 
97
    outCp.data[1]=(BYTE)((BOOT_VERSION & 0xFF00)>>8);
-
 
98
    outCp.data[0]=(BOOT_VERSION & 0xFF);
98
    StatusReset();
99
    StatusReset();
99
    while(!canSendMessage(outCp));
100
    while(!canSendMessage(outCp));
100
   
101
   
101
    LED0_IO= 1;
102
    LED0_IO= 1;
102
 
103
 
Line 454... Line 455...
454
            cp.boot.rid   = RXB0EIDH;
455
            cp.boot.rid   = RXB0EIDH;
455
        }
456
        }
456
        else
457
        else
457
        {
458
        {
458
            cp.pgm.class= ((RXB0SIDH&0x3C)>>2);
459
            cp.pgm.class= ((RXB0SIDH&0x3C)>>2);
459
            cp.pgm.id   = (((WORD)RXB0SIDH&0x3)<<13)+(((WORD)RXB0SIDL&0xE0)<<5)+((RXB0SIDL&0x3)<<8)+RXB0EIDH;
460
            cp.pgm.id   = (((WORD)RXB0SIDH&0x3)<<13)+(((WORD)RXB0SIDL&0xE0)<<5)+(((WORD)RXB0SIDL&0x3)<<8)+(WORD)RXB0EIDH;
460
        }
461
        }
461
        cp.sid   = RXB0EIDL;
462
        cp.sid   = RXB0EIDL;
462
 
463
 
463
 
464
 
464
        // Data length
465
        // Data length