Révision 3
Ajouté par Jacques LAFFONT il y a plus de 6 ans
trunk/tp_info6/bsp/periph.c | ||
---|---|---|
|
||
|
||
|
||
Tperiph periph[26];
|
||
Tperiph periph['z'-'A'];
|
||
|
||
#define eot 0x0D
|
||
|
||
... | ... | |
int i;
|
||
uart0_init();
|
||
dma0_init();
|
||
for (i=0;i<26;i++)
|
||
for (i=0;i<'z'-'A';i++)
|
||
periph[i].maj=periph[i].val=periph[i].ev=0;
|
||
|
||
}
|
||
... | ... | |
periph_write('I',c);
|
||
dly_tsk(0);
|
||
i++;
|
||
if (i>=8) break;
|
||
if (i>=64) break;
|
||
}while (c=*(++nom));
|
||
periph_write('I',0);
|
||
dly_tsk(0);
|
||
... | ... | |
ipsnd_dtq (CanTx,(VP_INT) comm.msg);
|
||
}
|
||
|
||
static int hex_2_int (char * str)
|
||
{
|
||
int i;
|
||
long val;
|
||
val=0;
|
||
for (i=0;i<4;i++)
|
||
{
|
||
val=(val*16);
|
||
val+=(str[i]>='A')?(int) str[i]-'A'+10:(int)str[i]-'0';
|
||
}
|
||
if (val>0x7FFF) val=val-0x10000;
|
||
return val;
|
||
static int hex_2_int (char * str)
|
||
{
|
||
int i;
|
||
long val;
|
||
val=0;
|
||
for (i=0;i<4;i++)
|
||
{
|
||
val=(val*16);
|
||
val+=(str[i]>='A')?(int) str[i]-'A'+10:(int)str[i]-'0';
|
||
}
|
||
if (val>0x7FFF) val=val-0x10000;
|
||
return val;
|
||
}
|
||
|
||
static void int_2_hex(unsigned int val, char * str)
|
trunk/tp_info6/bsp/periph.h | ||
---|---|---|
|
||
#define ADDR(x) ((x & ~0x20) - 'A')
|
||
#define ADDR(x) (x -'A')
|
||
|
||
int periph_read (char addr,int * val);
|
||
void periph_write (char addr,int valeur);
|
||
... | ... | |
|
||
void periph_init(void);
|
||
|
||
extern Tperiph periph[26];
|
||
extern int canal[7];
|
||
extern int canal_ok;
|
||
extern Tperiph periph['z'-'A'];
|
Formats disponibles : Unified diff
Correction périphériques.