nico@207: nico@207:
nico@207:#include <string.h>
#include <stdio.h>
#include <../include/hcs12/asm-m68hc12/portsaccess.h>
#include <../include/hcs12/asm-m68hc12/ports_def.h>
#include <../include/hcs12/asm-m68hc12/ports.h>
#include <../include/hcs12/interrupt.h>
#include "can.h"
nico@207: Go to the source code of this file.
Defines | |
#define | CANOPEN_BIG_ENDIAN 1 |
Define the architecture : little_endian or big_endian. | |
#define | BUS_CLOCK 8 |
#define | SERIAL_SCI0_BAUD_RATE 38400 |
Configuration of the serials port SCI0 and SCI1. | |
#define | SERIAL_SCI1_BAUD_RATE 9600 |
#define | INTEGER8 signed char |
#define | INTEGER16 short |
#define | INTEGER24 |
#define | INTEGER32 long |
#define | INTEGER40 |
#define | INTEGER48 |
#define | INTEGER56 |
#define | INTEGER64 |
#define | UNS8 unsigned char |
#define | UNS16 unsigned short |
#define | UNS32 unsigned long |
#define | UNS24 |
#define | UNS40 |
#define | UNS48 |
#define | UNS56 |
#define | UNS64 |
#define | TIMEVAL UNS32 |
#define | TIMEVAL_MAX 0xFFFF |
#define | MS_TO_TIMEVAL(ms) (ms * 250) |
#define | US_TO_TIMEVAL(us) (us>>2) |
#define | REAL32 float |
#define | REAL64 double |
#define | MSG_ERR(num, str, val) |
Definition of MSG_ERR. | |
#define | MSG_WAR(num, str, val) |
Definition of MSG_WAR. | |
Functions | |
void | initSCI_0 (void) |
Initialisation of the serial port 0. | |
void | initSCI_1 (void) |
Initialisation of the serial port 1. | |
char * | hex_convert (char *buf, unsigned long value, char lastCar) |
void | printSCI_str (char sci, const char *str) |
void | printSCI_nbr (char sci, unsigned long nbr, char lastCar) |
void | initPLL (void) |
void | initHCS12 (void) |
Put here all the code to init the HCS12. |
#define BUS_CLOCK 8 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 65 of file applicfg.h. nico@207:
#define CANOPEN_BIG_ENDIAN 1 | nico@207:
nico@207: Define the architecture : little_endian or big_endian. nico@207:
nico@207: nico@207:
nico@207: Definition at line 55 of file applicfg.h. nico@207:
#define INTEGER16 short | nico@207:
nico@207: nico@207:
nico@207: Definition at line 130 of file applicfg.h. nico@207:
#define INTEGER24 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 131 of file applicfg.h. nico@207:
#define INTEGER32 long | nico@207:
nico@207: nico@207:
nico@207: Definition at line 132 of file applicfg.h. nico@207:
#define INTEGER40 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 133 of file applicfg.h. nico@207:
#define INTEGER48 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 134 of file applicfg.h. nico@207:
#define INTEGER56 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 135 of file applicfg.h. nico@207:
#define INTEGER64 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 136 of file applicfg.h. nico@207:
#define INTEGER8 signed char | nico@207:
nico@207: nico@207:
nico@207: Definition at line 129 of file applicfg.h. nico@207:
#define MS_TO_TIMEVAL | nico@207:( | nico@207:ms | nico@207:nico@207: | ) | nico@207:(ms * 250) | nico@207:
nico@207: nico@207:
nico@207: Definition at line 156 of file applicfg.h. nico@207:
#define MSG_ERR | nico@207:( | nico@207:num, | |||
nico@207: | nico@207: | str, | |||
nico@207: | nico@207: | val | nico@207:nico@207: | ) | nico@207:nico@207: |
nico@207: Definition of MSG_ERR. nico@207:
nico@207: nico@207:
nico@207: Definition at line 177 of file applicfg.h. nico@207:
#define MSG_WAR | nico@207:( | nico@207:num, | |||
nico@207: | nico@207: | str, | |||
nico@207: | nico@207: | val | nico@207:nico@207: | ) | nico@207:nico@207: |
nico@207: Definition of MSG_WAR. nico@207:
nico@207: nico@207:
nico@207: Definition at line 190 of file applicfg.h. nico@207:
#define REAL32 float | nico@207:
nico@207: nico@207:
nico@207: Definition at line 161 of file applicfg.h. nico@207:
#define REAL64 double | nico@207:
nico@207: nico@207:
nico@207: Definition at line 162 of file applicfg.h. nico@207:
#define SERIAL_SCI0_BAUD_RATE 38400 | nico@207:
nico@207: Configuration of the serials port SCI0 and SCI1. nico@207:
nico@207: nico@207:
nico@207: Definition at line 82 of file applicfg.h. nico@207:
#define SERIAL_SCI1_BAUD_RATE 9600 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 83 of file applicfg.h. nico@207:
#define TIMEVAL UNS32 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 150 of file applicfg.h. nico@207:
#define TIMEVAL_MAX 0xFFFF | nico@207:
nico@207: nico@207:
nico@207: Definition at line 153 of file applicfg.h. nico@207:
#define UNS16 unsigned short | nico@207:
nico@207: nico@207:
nico@207: Definition at line 140 of file applicfg.h. nico@207:
#define UNS24 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 142 of file applicfg.h. nico@207:
#define UNS32 unsigned long | nico@207:
nico@207: nico@207:
nico@207: Definition at line 141 of file applicfg.h. nico@207:
#define UNS40 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 143 of file applicfg.h. nico@207:
#define UNS48 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 144 of file applicfg.h. nico@207:
#define UNS56 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 145 of file applicfg.h. nico@207:
#define UNS64 | nico@207:
nico@207: nico@207:
nico@207: Definition at line 146 of file applicfg.h. nico@207:
#define UNS8 unsigned char | nico@207:
nico@207: nico@207:
nico@207: Definition at line 139 of file applicfg.h. nico@207:
#define US_TO_TIMEVAL | nico@207:( | nico@207:us | nico@207:nico@207: | ) | nico@207:(us>>2) | nico@207:
nico@207: nico@207:
nico@207: Definition at line 157 of file applicfg.h. nico@207:
nico@207:
char* hex_convert | nico@207:( | nico@207:char * | nico@207:buf, | nico@207:|
nico@207: | nico@207: | unsigned long | nico@207:value, | nico@207:|
nico@207: | nico@207: | char | nico@207:lastCar | nico@207: |
nico@207: | ) | nico@207:nico@207: |
nico@207: Convert an integer to a string in hexadecimal format If you do not wants to use a lastCar, put lastCar = '' (end of string) ex : value = 0XABCDEF and lastCar = '
nico@207: ' buf[0] = '0' buf[1] = 'X' buf[2] = 'A' .... buf[7] = 'F' buf[8] = '
nico@207: ' buf[9] = ''
nico@207:
nico@207: Definition at line 135 of file canOpenDriver.c. nico@207:
void initHCS12 | nico@207:( | nico@207:void | nico@207:nico@207: | ) | nico@207:nico@207: |
nico@207: Put here all the code to init the HCS12. nico@207:
nico@207: nico@207:
nico@207: Definition at line 199 of file canOpenDriver.c. nico@207:
void initPLL | nico@207:( | nico@207:void | nico@207:nico@207: | ) | nico@207:nico@207: |
nico@207: to start using the PLL. Bus clock becomes 24 MHz if the quartz on the board is at 16 MHz nico@207:
nico@207: Definition at line 188 of file canOpenDriver.c. nico@207:
nico@207: References CLKSEL, CRGFLG, IO_PORTS_8, PLLCTL, REFDV, and SYNR. nico@207:
void initSCI_0 | nico@207:( | nico@207:void | nico@207:nico@207: | ) | nico@207:nico@207: |
nico@207: Initialisation of the serial port 0. nico@207:
nico@207: nico@207:
nico@207: Definition at line 115 of file canOpenDriver.c. nico@207:
nico@207: References BUS_CLOCK, IO_PORTS_16, IO_PORTS_8, SCI0, SCIBDH, SCICR1, SCICR2, and SERIAL_SCI0_BAUD_RATE. nico@207:
void initSCI_1 | nico@207:( | nico@207:void | nico@207:nico@207: | ) | nico@207:nico@207: |
nico@207: Initialisation of the serial port 1. nico@207:
nico@207: nico@207:
nico@207: Definition at line 124 of file canOpenDriver.c. nico@207:
nico@207: References BUS_CLOCK, IO_PORTS_16, IO_PORTS_8, SCI1, SCIBDH, SCICR1, SCICR2, and SERIAL_SCI1_BAUD_RATE. nico@207:
void printSCI_nbr | nico@207:( | nico@207:char | nico@207:sci, | nico@207:|
nico@207: | nico@207: | unsigned long | nico@207:nbr, | nico@207:|
nico@207: | nico@207: | char | nico@207:lastCar | nico@207: |
nico@207: | ) | nico@207:nico@207: |
nico@207: Print the number in hexadecimal to the serial port sci (sci takes the values SCI0 or SCI1) nico@207:
nico@207: Definition at line 179 of file canOpenDriver.c. nico@207:
nico@207: References hex_convert(), and printSCI_str(). nico@207:
void printSCI_str | nico@207:( | nico@207:char | nico@207:sci, | nico@207:|
nico@207: | nico@207: | const char * | nico@207:str | nico@207: |
nico@207: | ) | nico@207:nico@207: |
nico@207: Print the string to the serial port sci (sci takes the values SCI0 or SCI1) nico@207:
nico@207: Definition at line 162 of file canOpenDriver.c. nico@207:
nico@207: References IO_PORTS_8, SCIDRL, and SCISR1. nico@207:
nico@207: