reprogrammation.h File Reference

Description : constant, struct and function prototype for reprogrammation feature. More...

#include <Environment.h>
#include <string.h>
#include <flash_memory.h>
#include <timedef.h>
#include <display_info.h>
#include <stdlib.h>
#include <cc2420.h>
#include <hal_wait.h>
#include <serial.h>
#include <controller.h>

Include dependency graph for reprogrammation.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DATA_PACKET
struct  JUST_CRC
struct  MEMORY_INFO_STRUCT
struct  MESSAGE_HEADER
struct  REQ_PACKET
struct  SOFT_INFO

Defines

#define BOOT_START_ADDR   0x2590
#define BOOT_TIMER_IT_ADDR   0x3430
#define BROADCAST_ID   0xFFFF
#define CHANNEL_EXPLOITATION   18
#define CHANNEL_REPROG   20
#define CONST_ADDR   0x4000
#define DONT_MEMORISE_ADRESS   0
#define END_ADDR   0x8000
#define ERROR_THRESHOLD   5
#define IT_ADC12   0xFFFF
#define IT_COMPA   0xFFFF
#define IT_DACDMA   0xFFFF
#define IT_NMI   0xFFFF
#define IT_PORT1   0xFFFF
#define IT_PORT2   0xFFFF
#define IT_TIMERA0   0xFFFF
#define IT_TIMERA1   0xFFFF
#define IT_TIMERB0   0x7690
#define IT_TIMERB1   0xFFFF
#define IT_USART0RX   0xFFFF
#define IT_USART0TX   0xFFFF
#define IT_USART1RX   0xFFFF
#define IT_USART1TX   0xFFFF
#define IT_WDT   0xFFFF
#define MEMORISE_ADRESS   1
#define NB_REPROG_TRY   5
#define NB_SOFT_REQ   5
#define SEND_BROADCAST   1
#define SEND_UNICAST   0
#define SIZE_DATA_BUFFER   116
#define SIZE_SOFT_BUFFER   512
#define START_ADDR   0x4300
#define TEMPO_ORDER_REPROG   2000
#define TEMPO_PURGE_SEND_BUFFER   12000
#define TYPE_ACK   1
#define TYPE_DATA   5
#define TYPE_ORDER_REPROG   6
#define TYPE_PROGAM_INFO   3
#define TYPE_REQ_PCKT   4
#define TYPE_REQ_SOFT_VERS   2
#define VERSION_CODE   0x01
#define WAIT_ANSWER_CLIENT   250
#define WAIT_ANSWER_SERVER   180

Functions

int check_online_code_version (void)
 For client device : ask online last code version and receive program informations if there is and an update online.
void copy_interrupt_vector (void)
 copy interrupt vector into information memory
void erase_interrupt_vector (void)
 function to erase interrupt vector memory segment
int MAC_recept (char *, UINT8 *, UINT16, UINT8)
int MAC_send (char *, UINT8, UINT8)
void serveur_reprog (void)
 this function handle ppp RF protocol for upload software "over the air"
void try_perform_update (void)
 reboot on bootloader to update exploitation software
void write_interrupt_vector (UINT16, UINT16)
 function to write on interrupt vector (for reprogrammation)
void write_start_end_adress (void)
 function to write start/end adress/ code version to information memory

Variables

const UINT16 adc12
UINT16 buffer_phy [64]
const UINT16 comparatorA
const UINT16 dacdma
unsigned int Deadline_order_reprog
UINT16 his_id
MESSAGE_HEADERmes
char * mpdu
const UINT16 nmi
UINT16 our_id
const UINT16 port1
const UINT16 port2
MEMORY_INFO_STRUCTptr_info_prog
char * ptr_interrupt_vector
const UINT16 reset
const UINT16 timerA0
const UINT16 timerA1
const UINT16 timerB0
const UINT16 timerB1
const UINT16 usart0rx
const UINT16 usart0tx
const UINT16 usart1rx
const UINT16 usart1tx
const UINT16 wdt


Detailed Description

Description : constant, struct and function prototype for reprogrammation feature.

Author:
ANGER Thomas
Date:
2008 / 12 / 16

Definition in file reprogrammation.h.


Define Documentation

#define BOOT_START_ADDR   0x2590

Definition at line 89 of file reprogrammation.h.

Referenced by try_perform_update().

#define BOOT_TIMER_IT_ADDR   0x3430

Definition at line 90 of file reprogrammation.h.

Referenced by try_perform_update().

#define BROADCAST_ID   0xFFFF

Definition at line 40 of file reprogrammation.h.

Referenced by MAC_recept(), MAC_send(), main(), and serveur_reprog().

#define CHANNEL_EXPLOITATION   18

Definition at line 55 of file reprogrammation.h.

Referenced by check_online_code_version(), init(), main(), and serveur_reprog().

#define CHANNEL_REPROG   20

Definition at line 54 of file reprogrammation.h.

Referenced by check_online_code_version(), and main().

#define CONST_ADDR   0x4000

Definition at line 82 of file reprogrammation.h.

Referenced by write_start_end_adress().

#define DONT_MEMORISE_ADRESS   0

Definition at line 36 of file reprogrammation.h.

Referenced by main(), and serveur_reprog().

#define END_ADDR   0x8000

Definition at line 84 of file reprogrammation.h.

Referenced by write_start_end_adress().

#define ERROR_THRESHOLD   5

Definition at line 31 of file reprogrammation.h.

Referenced by main().

#define IT_ADC12   0xFFFF

Definition at line 70 of file reprogrammation.h.

#define IT_COMPA   0xFFFF

Definition at line 74 of file reprogrammation.h.

#define IT_DACDMA   0xFFFF

Definition at line 63 of file reprogrammation.h.

#define IT_NMI   0xFFFF

Definition at line 77 of file reprogrammation.h.

#define IT_PORT1   0xFFFF

Definition at line 67 of file reprogrammation.h.

#define IT_PORT2   0xFFFF

Definition at line 64 of file reprogrammation.h.

#define IT_TIMERA0   0xFFFF

Definition at line 69 of file reprogrammation.h.

#define IT_TIMERA1   0xFFFF

Definition at line 68 of file reprogrammation.h.

#define IT_TIMERB0   0x7690

Definition at line 76 of file reprogrammation.h.

#define IT_TIMERB1   0xFFFF

Definition at line 75 of file reprogrammation.h.

#define IT_USART0RX   0xFFFF

Definition at line 72 of file reprogrammation.h.

#define IT_USART0TX   0xFFFF

Definition at line 71 of file reprogrammation.h.

#define IT_USART1RX   0xFFFF

Definition at line 66 of file reprogrammation.h.

#define IT_USART1TX   0xFFFF

Definition at line 65 of file reprogrammation.h.

#define IT_WDT   0xFFFF

Definition at line 73 of file reprogrammation.h.

#define MEMORISE_ADRESS   1

Definition at line 37 of file reprogrammation.h.

Referenced by check_online_code_version().

#define NB_REPROG_TRY   5

Definition at line 33 of file reprogrammation.h.

Referenced by main().

#define NB_SOFT_REQ   5

Definition at line 32 of file reprogrammation.h.

Referenced by check_online_code_version().

#define SEND_BROADCAST   1

Definition at line 39 of file reprogrammation.h.

Referenced by check_online_code_version(), and PT_THREAD().

#define SEND_UNICAST   0

Definition at line 38 of file reprogrammation.h.

Referenced by main(), and serveur_reprog().

#define SIZE_DATA_BUFFER   116

Definition at line 29 of file reprogrammation.h.

Referenced by main(), and serveur_reprog().

#define SIZE_SOFT_BUFFER   512

Definition at line 30 of file reprogrammation.h.

Referenced by main(), and serveur_reprog().

#define START_ADDR   0x4300

Definition at line 83 of file reprogrammation.h.

#define TEMPO_ORDER_REPROG   2000

Definition at line 93 of file reprogrammation.h.

Referenced by PT_THREAD().

#define TEMPO_PURGE_SEND_BUFFER   12000

Definition at line 94 of file reprogrammation.h.

Referenced by PT_THREAD().

#define TYPE_ACK   1

Definition at line 45 of file reprogrammation.h.

Referenced by MAC_send(), main(), and serveur_reprog().

#define TYPE_DATA   5

Definition at line 49 of file reprogrammation.h.

Referenced by MAC_send(), main(), and serveur_reprog().

#define TYPE_ORDER_REPROG   6

Definition at line 50 of file reprogrammation.h.

Referenced by MAC_send(), and PT_THREAD().

#define TYPE_PROGAM_INFO   3

Definition at line 47 of file reprogrammation.h.

Referenced by check_online_code_version(), MAC_send(), and serveur_reprog().

#define TYPE_REQ_PCKT   4

Definition at line 48 of file reprogrammation.h.

Referenced by MAC_send(), main(), and serveur_reprog().

#define TYPE_REQ_SOFT_VERS   2

Definition at line 46 of file reprogrammation.h.

Referenced by check_online_code_version(), MAC_send(), and PT_THREAD().

#define VERSION_CODE   0x01

Definition at line 85 of file reprogrammation.h.

#define WAIT_ANSWER_CLIENT   250

Definition at line 43 of file reprogrammation.h.

Referenced by check_online_code_version(), and main().

#define WAIT_ANSWER_SERVER   180

Definition at line 42 of file reprogrammation.h.

Referenced by serveur_reprog().


Function Documentation

int check_online_code_version ( void   ) 

For client device : ask online last code version and receive program informations if there is and an update online.

Returns:
0 : onchip version is up-to-date

1 : onchip version have to be update

Definition at line 355 of file reprogrammation.c.

References cc2420_change_channel(), SOFT_INFO::channel, CHANNEL_EXPLOITATION, CHANNEL_REPROG, controller_read_alarm_frame(), erase_info_memory(), flash_info_write(), MAC_recept(), MAC_send(), MEMORISE_ADRESS, NB_SOFT_REQ, SEND_BROADCAST, type, TYPE_PROGAM_INFO, TYPE_REQ_SOFT_VERS, MEMORY_INFO_STRUCT::version, SOFT_INFO::version, WAIT_ANSWER_CLIENT, and wakeup_cc2420().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void copy_interrupt_vector ( void   ) 

copy interrupt vector into information memory

Definition at line 233 of file reprogrammation.c.

References erase_info_memory(), flash_info_write(), and ptr_interrupt_vector.

Referenced by init().

Here is the call graph for this function:

Here is the caller graph for this function:

void erase_interrupt_vector ( void   ) 

function to erase interrupt vector memory segment

Definition at line 98 of file reprogrammation.c.

References init_flash(), and stop_flash().

Referenced by main(), and try_perform_update().

Here is the call graph for this function:

Here is the caller graph for this function:

int MAC_recept ( char *  ,
UINT8 ,
UINT16  ,
UINT8   
)

Definition at line 143 of file reprogrammation.c.

References BROADCAST_ID, buffer_phy, MESSAGE_HEADER::dest_id, MESSAGE_HEADER::lenght, mpdu, RecepFrame(), MESSAGE_HEADER::source_id, and MESSAGE_HEADER::type.

Referenced by check_online_code_version(), main(), and serveur_reprog().

Here is the call graph for this function:

Here is the caller graph for this function:

int MAC_send ( char *  ,
UINT8  ,
UINT8   
)

void serveur_reprog ( void   ) 

this function handle ppp RF protocol for upload software "over the air"

Definition at line 267 of file reprogrammation.c.

References BROADCAST_ID, cc2420_change_channel(), cc2420_powerdown(), CHANNEL_EXPLOITATION, clockb(), DATA_PACKET::data, display_number(), DONT_MEMORISE_ADRESS, halWait(), DATA_PACKET::id, MAC_recept(), MAC_send(), MAX_HAL_WAIT, MAX_TICK, MAX_UINT16, SEND_UNICAST, serial_puts(), SIZE_DATA_BUFFER, SIZE_SOFT_BUFFER, type, TYPE_ACK, TYPE_DATA, TYPE_PROGAM_INFO, TYPE_REQ_PCKT, WAIT_ANSWER_SERVER, and wakeup_cc2420().

Referenced by PT_THREAD().

Here is the call graph for this function:

Here is the caller graph for this function:

try_perform_update ( void   ) 

reboot on bootloader to update exploitation software

Definition at line 247 of file reprogrammation.c.

References _DINT, BOOT_START_ADDR, BOOT_TIMER_IT_ADDR, erase_interrupt_vector(), and write_interrupt_vector().

Referenced by PT_THREAD().

Here is the call graph for this function:

Here is the caller graph for this function:

void write_interrupt_vector ( UINT16  addr,
UINT16  it 
)

function to write on interrupt vector (for reprogrammation)

Parameters:
[in] addr : begin adress of new program
[in] it : id of interrupt vector adress to write
Note:
DACDMA_VECTOR 0xFFE0 DAC/DMA

PORT2_VECTOR 0xFFE2 Port 2

USART1TX_VECTOR 0xFFE4 USART 1 Transmit

USART1RX_VECTOR 0xFFE6 USART 1 Receive

PORT1_VECTOR 0xFFE8 Port 1

TIMERA1_VECTOR xFFEA Timer A CC1-2, TA

TIMERA0_VECTOR 0xFFEC Timer A CC0

ADC12_VECTOR 0xFFEE ADC

USART0TX_VECTOR 0xFFF0 USAT 0 Transmit

USART0RX_VECTOR 0xFFF2 USART 0 Receive

WDT_VECTOR 0xFFF4 Watchdog Timer

COMPARATORA_VECTOR 0xFFF6 Comparator A

TIMERB1_VECTOR 0xFFF8 Timer B CC1-6, TB

TIMERB0_VECTOR 0xFFFA Timer B CC0

NMI_VECTOR 0xFFFC Non-maskable

RESET_VECTOR 0xFFFE Reset [Highest Priority]

Definition at line 79 of file reprogrammation.c.

References init_flash(), and stop_flash().

Referenced by main(), and try_perform_update().

Here is the call graph for this function:

Here is the caller graph for this function:

void write_start_end_adress ( void   ) 

function to write start/end adress/ code version to information memory

Definition at line 119 of file reprogrammation.c.

References CONST_ADDR, END_ADDR, MEMORY_INFO_STRUCT::end_addr, init_flash(), MEMORY_INFO_STRUCT::start_addr, stop_flash(), MEMORY_INFO_STRUCT::version, and VERSION_CODE.

Referenced by init().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const UINT16 adc12

Definition at line 39 of file reprogrammation.c.

Definition at line 63 of file controllerCC2420.c.

Definition at line 43 of file reprogrammation.c.

const UINT16 dacdma

Definition at line 32 of file reprogrammation.c.

unsigned int Deadline_order_reprog

Definition at line 27 of file reprogrammation.c.

Referenced by PT_THREAD().

Definition at line 25 of file reprogrammation.c.

Referenced by PT_THREAD().

char* mpdu

Referenced by MAC_recept(), and MAC_send().

const UINT16 nmi

Definition at line 46 of file reprogrammation.c.

Definition at line 25 of file reprogrammation.c.

Referenced by main().

const UINT16 port1

Definition at line 36 of file reprogrammation.c.

const UINT16 port2

Definition at line 33 of file reprogrammation.c.

Definition at line 19 of file reprogrammation.c.

Referenced by main(), and PT_THREAD().

Definition at line 20 of file reprogrammation.c.

Referenced by copy_interrupt_vector().

const UINT16 reset

Definition at line 47 of file reprogrammation.c.

const UINT16 timerA0

Definition at line 38 of file reprogrammation.c.

const UINT16 timerA1

Definition at line 37 of file reprogrammation.c.

const UINT16 timerB0

Definition at line 45 of file reprogrammation.c.

const UINT16 timerB1

Definition at line 44 of file reprogrammation.c.

Definition at line 41 of file reprogrammation.c.

Definition at line 40 of file reprogrammation.c.

Definition at line 35 of file reprogrammation.c.

Definition at line 34 of file reprogrammation.c.

const UINT16 wdt

Definition at line 42 of file reprogrammation.c.


Generated on Wed Jun 3 12:06:01 2009 for PowWow v1.0 by  doxygen 1.5.6