nico@215: nico@215:
nico@215:#include <stddef.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/data.h"
#include "../include/hcs12/applicfg.h"
#include "../include/hcs12/candriver.h"
#include "../include/hcs12/interrupt.h"
#include "../include/hcs12/canOpenDriver.h"
#include "../include/can.h"
#include "../include/objdictdef.h"
#include "../include/timer.h"
nico@215: Include dependency graph for canOpenDriver.c:
nico@215: Go to the source code of this file.
Defines | |
#define | DEBUG_WAR_CONSOLE_ON |
#define | DEBUG_ERR_CONSOLE_ON |
#define | max(a, b) a>b?a:b |
Functions | |
UNS8 | f_can_receive (UNS8 notused, Message *m) |
UNS8 | canSend (UNS8 notused, Message *m) |
void | __attribute__ ((interrupt)) |
TIMEVAL | getElapsedTime () |
void | resetTimer (void) |
void | initTimer (void) |
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. | |
char | canAddIdToFilter (UNS16 adrCAN, UNS8 nFilter, UNS16 id) |
char | canChangeFilter (UNS16 adrCAN, canBusFilterInit fi) |
char | canEnable (UNS16 adrCAN) |
char | canInit (UNS16 adrCAN, canBusInit bi) |
char | canInitClock (UNS16 adrCAN, canBusTime clk) |
char | canInit1Filter (UNS16 adrCAN, UNS8 nFilter, UNS16 ar, UNS16 mr) |
char | canInitFilter (UNS16 adrCAN, canBusFilterInit fi) |
char | canInitMode (UNS16 adrCAN) |
char | canInitModeQ (UNS16 adrCAN) |
char | canMsgTransmit (UNS16 adrCAN, Message msg) |
char | canSetInterrupt (UNS16 adrCAN) |
char | canSleepMode (UNS16 adrCAN) |
char | canSleepModeQ (UNS16 adrCAN) |
char | canSleepWupMode (UNS16 adrCAN) |
char | canTestInitMode (UNS16 adrCAN) |
char | canTestSleepMode (UNS16 adrCAN) |
#define DEBUG_ERR_CONSOLE_ON | nico@215:
nico@215: nico@215:
nico@215: Definition at line 24 of file canOpenDriver.c. nico@215:
#define DEBUG_WAR_CONSOLE_ON | nico@215:
nico@215: nico@215:
nico@215: Definition at line 23 of file canOpenDriver.c. nico@215:
#define max | nico@215:( | nico@215:a, | |||
nico@215: | nico@215: | b | nico@215:nico@215: | ) | nico@215:a>b?a:b | nico@215:
nico@215: nico@215:
nico@215:
void __attribute__ | nico@215:( | nico@215:(interrupt) | nico@215:nico@215: | ) | nico@215:nico@215: |
nico@215: Message transmitted on MSCAN 0 nico@215:
nico@215: Definition at line 54 of file canOpenDriver.c. nico@215:
nico@215: References IO_PORTS_16, and TC4H. nico@215:
char canAddIdToFilter | nico@215:( | nico@215:UNS16 | nico@215:adrCAN, | nico@215:|
nico@215: | nico@215: | UNS8 | nico@215:nFilter, | nico@215:|
nico@215: | nico@215: | UNS16 | nico@215:id | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 210 of file canOpenDriver.c. nico@215:
nico@215: References CANIDAR0, CANIDAR2, CANIDAR4, CANIDAR6, canTestInitMode(), IO_PORTS_16, IO_PORTS_8, MSG_WAR, and UNS8. nico@215:
etisserant@240: Here is the call graph for this function:
char canChangeFilter | nico@215:( | nico@215:UNS16 | nico@215:adrCAN, | nico@215:|
nico@215: | nico@215: | canBusFilterInit | nico@215:fi | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 250 of file canOpenDriver.c. nico@215:
nico@215: References canInitFilter(), canInitMode(), canInitModeQ(), canSetInterrupt(), canSleepMode(), canSleepModeQ(), and canTestInitMode(). nico@215:
nico@215: Referenced by gene_SYNC_operational(), and gene_SYNC_preOperational(). nico@215:
etisserant@240: Here is the call graph for this function:
char canEnable | nico@215:( | nico@215:UNS16 | nico@215:adrCAN | nico@215:) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 266 of file canOpenDriver.c. nico@215:
nico@215: References CANCTL1, and IO_PORTS_8. nico@215:
nico@215: Referenced by canInit(). nico@215:
char canInit | nico@215:( | nico@215:UNS16 | nico@215:adrCAN, | nico@215:|
nico@215: | nico@215: | canBusInit | nico@215:bi | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 277 of file canOpenDriver.c. nico@215:
nico@215: References CANCTL0, CANCTL1, canBusInit::cane, canEnable(), canInitClock(), canInitFilter(), canInitMode(), canInitModeQ(), canSetInterrupt(), canSleepMode(), canSleepModeQ(), canTestInitMode(), canBusInit::clk, canBusInit::cswai, canBusInit::fi, IO_PORTS_8, canBusInit::listen, canBusInit::loopb, canBusInit::time, and canBusInit::wupm. nico@215:
etisserant@240: Here is the call graph for this function:
char canInit1Filter | nico@215:( | nico@215:UNS16 | nico@215:adrCAN, | nico@215:|
nico@215: | nico@215: | UNS8 | nico@215:nFilter, | nico@215:|
nico@215: | nico@215: | UNS16 | nico@215:ar, | nico@215:|
nico@215: | nico@215: | UNS16 | nico@215:mr | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 335 of file canOpenDriver.c. nico@215:
nico@215: References CANIDAR0, CANIDAR2, CANIDAR4, CANIDAR6, canTestInitMode(), IO_PORTS_8, MSG_WAR, and UNS8. nico@215:
etisserant@240: Here is the call graph for this function:
char canInitClock | nico@215:( | nico@215:UNS16 | nico@215:adrCAN, | nico@215:|
nico@215: | nico@215: | canBusTime | nico@215:clk | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 313 of file canOpenDriver.c. nico@215:
nico@215: References canBusTime::brp, CANBTR0, CANBTR1, CANCTL1, canTestInitMode(), canBusTime::clksrc, IO_PORTS_8, MSG_WAR, canBusTime::samp, canBusTime::sjw, canBusTime::tseg1, and canBusTime::tseg2. nico@215:
nico@215: Referenced by canInit(). nico@215:
etisserant@240: Here is the call graph for this function:
char canInitFilter | nico@215:( | nico@215:UNS16 | nico@215:adrCAN, | nico@215:|
nico@215: | nico@215: | canBusFilterInit | nico@215:fi | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 364 of file canOpenDriver.c. nico@215:
nico@215: References CANIDAC, CANIDAR0, canBusFilterInit::canidar0, CANIDAR1, canBusFilterInit::canidar1, CANIDAR2, canBusFilterInit::canidar2, CANIDAR3, canBusFilterInit::canidar3, CANIDAR4, canBusFilterInit::canidar4, CANIDAR5, canBusFilterInit::canidar5, CANIDAR6, canBusFilterInit::canidar6, CANIDAR7, canBusFilterInit::canidar7, CANIDMR0, canBusFilterInit::canidmr0, CANIDMR1, canBusFilterInit::canidmr1, CANIDMR2, canBusFilterInit::canidmr2, CANIDMR3, canBusFilterInit::canidmr3, CANIDMR4, canBusFilterInit::canidmr4, CANIDMR5, canBusFilterInit::canidmr5, CANIDMR6, canBusFilterInit::canidmr6, CANIDMR7, canBusFilterInit::canidmr7, canTestInitMode(), canBusFilterInit::idam, IO_PORTS_8, and MSG_WAR. nico@215:
nico@215: Referenced by canChangeFilter(), and canInit(). nico@215:
etisserant@240: Here is the call graph for this function:
char canInitMode | nico@215:( | nico@215:UNS16 | nico@215:adrCAN | nico@215:) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 392 of file canOpenDriver.c. nico@215:
nico@215: References CANCTL0, canTestInitMode(), and IO_PORTS_8. nico@215:
nico@215: Referenced by canChangeFilter(), and canInit(). nico@215:
etisserant@240: Here is the call graph for this function:
char canInitModeQ | nico@215:( | nico@215:UNS16 | nico@215:adrCAN | nico@215:) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 401 of file canOpenDriver.c. nico@215:
nico@215: References CANCTL0, canTestInitMode(), and IO_PORTS_8. nico@215:
nico@215: Referenced by canChangeFilter(), and canInit(). nico@215:
etisserant@240: Here is the call graph for this function:
char canMsgTransmit | nico@215:( | nico@215:UNS16 | nico@215:adrCAN, | nico@215:|
nico@215: | nico@215: | Message | nico@215:msg | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 410 of file canOpenDriver.c. nico@215:
nico@215: References CANTBSEL, CANTFLG, CANTRSDTA, CANTRSID, CANTRSLEN, CANTRSPRI, Message::cob_id, Message::data, IO_PORTS_8, Message::len, MSG_WAR, Message::rtr, UNS8, and SHORT_CAN::w. nico@215:
nico@215: Referenced by canSend(). nico@215:
UNS8 canSend | nico@215:( | nico@215:UNS8 | nico@215:notused, | nico@215:|
nico@215: | nico@215: | Message * | nico@215:m | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 505 of file canOpenDriver.c. nico@215:
nico@215: References canMsgTransmit(), and CANOPEN_LINE_NUMBER_USED. nico@215:
etisserant@240: Referenced by _sendPDOevent(), canSend(), LoadCanDriver(), masterSendNMTnodeguard(), masterSendNMTstateChange(), proceedNODE_GUARD(), proceedPDO(), ProducerHearbeatAlarm(), sendPDOrequest(), sendSDO(), sendSYNC(), and slaveSendBootUp(). etisserant@240:
etisserant@240: Here is the call graph for this function:
char canSetInterrupt | nico@215:( | nico@215:UNS16 | nico@215:adrCAN | nico@215:) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 445 of file canOpenDriver.c. nico@215:
nico@215: References CANRIER, CANTIER, and IO_PORTS_8. nico@215:
nico@215: Referenced by canChangeFilter(), and canInit(). nico@215:
char canSleepMode | nico@215:( | nico@215:UNS16 | nico@215:adrCAN | nico@215:) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 452 of file canOpenDriver.c. nico@215:
nico@215: References CANCTL0, canTestSleepMode(), and IO_PORTS_8. nico@215:
nico@215: Referenced by canChangeFilter(), and canInit(). nico@215:
etisserant@240: Here is the call graph for this function:
char canSleepModeQ | nico@215:( | nico@215:UNS16 | nico@215:adrCAN | nico@215:) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 466 of file canOpenDriver.c. nico@215:
nico@215: References CANCTL0, canTestInitMode(), canTestSleepMode(), IO_PORTS_8, and MSG_WAR. nico@215:
nico@215: Referenced by canChangeFilter(), and canInit(). nico@215:
etisserant@240: Here is the call graph for this function:
char canSleepWupMode | nico@215:( | nico@215:UNS16 | nico@215:adrCAN | nico@215:) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 480 of file canOpenDriver.c. nico@215:
nico@215: References CANCTL0, canTestInitMode(), canTestSleepMode(), IO_PORTS_8, and MSG_WAR. nico@215:
etisserant@240: Here is the call graph for this function:
char canTestInitMode | nico@215:( | nico@215:UNS16 | nico@215:adrCAN | nico@215:) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 493 of file canOpenDriver.c. nico@215:
nico@215: References CANCTL1, and IO_PORTS_8. nico@215:
nico@215: Referenced by canAddIdToFilter(), canChangeFilter(), canInit(), canInit1Filter(), canInitClock(), canInitFilter(), canInitMode(), canInitModeQ(), canSleepModeQ(), and canSleepWupMode(). nico@215:
char canTestSleepMode | nico@215:( | nico@215:UNS16 | nico@215:adrCAN | nico@215:) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 499 of file canOpenDriver.c. nico@215:
nico@215: References CANCTL1, and IO_PORTS_8. nico@215:
nico@215: Referenced by canSleepMode(), canSleepModeQ(), and canSleepWupMode(). nico@215:
UNS8 f_can_receive | nico@215:( | nico@215:UNS8 | nico@215:notused, | nico@215:|
nico@215: | nico@215: | Message * | nico@215:m | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 513 of file canOpenDriver.c. nico@215:
nico@215: References CAN0, CAN1, CAN2, CAN3, CAN4, CANOPEN_LINE_NUMBER_USED, Message::cob_id, Message::data, Message::len, MAX_STACK_MSG_RCV, t_pointerStack::r, Message::rtr, UNS8, and SHORT_CAN::w. nico@215:
nico@215: Referenced by main(). nico@215:
TIMEVAL getElapsedTime | nico@215:( | nico@215:void | nico@215:nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 66 of file canOpenDriver.c. nico@215:
nico@215: Referenced by StartTimerLoop(), and TimeDispatch(). nico@215:
char* hex_convert | nico@215:( | nico@215:char * | nico@215:buf, | nico@215:|
nico@215: | nico@215: | unsigned long | nico@215:value, | nico@215:|
nico@215: | nico@215: | char | nico@215:lastCar | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: 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@215: ' buf[0] = '0' buf[1] = 'X' buf[2] = 'A' .... buf[7] = 'F' buf[8] = '
nico@215: ' buf[9] = ''
nico@215:
nico@215: Definition at line 135 of file canOpenDriver.c. nico@215:
nico@215: Referenced by printSCI_nbr(). nico@215:
void initHCS12 | nico@215:( | nico@215:void | nico@215:nico@215: | ) | nico@215:nico@215: |
nico@215: Put here all the code to init the HCS12. nico@215:
nico@215: nico@215:
nico@215: Definition at line 199 of file canOpenDriver.c. nico@215:
nico@215: References initPLL(), and MSG_WAR. nico@215:
nico@215: Referenced by initSensor(). nico@215:
etisserant@240: Here is the call graph for this function:
void initPLL | nico@215:( | nico@215:void | nico@215:nico@215: | ) | nico@215:nico@215: |
nico@215: to start using the PLL. Bus clock becomes 24 MHz if the quartz on the board is at 16 MHz nico@215:
nico@215: Definition at line 188 of file canOpenDriver.c. nico@215:
nico@215: References CLKSEL, CRGFLG, IO_PORTS_8, PLLCTL, REFDV, and SYNR. nico@215:
nico@215: Referenced by initHCS12(). nico@215:
void initSCI_0 | nico@215:( | nico@215:void | nico@215:nico@215: | ) | nico@215:nico@215: |
nico@215: Initialisation of the serial port 0. nico@215:
nico@215: nico@215:
nico@215: Definition at line 115 of file canOpenDriver.c. nico@215:
nico@215: References BUS_CLOCK, IO_PORTS_16, IO_PORTS_8, SCI0, SCIBDH, SCICR1, SCICR2, and SERIAL_SCI0_BAUD_RATE. nico@215:
void initSCI_1 | nico@215:( | nico@215:void | nico@215:nico@215: | ) | nico@215:nico@215: |
nico@215: Initialisation of the serial port 1. nico@215:
nico@215: nico@215:
nico@215: Definition at line 124 of file canOpenDriver.c. nico@215:
nico@215: References BUS_CLOCK, IO_PORTS_16, IO_PORTS_8, SCI1, SCIBDH, SCICR1, SCICR2, and SERIAL_SCI1_BAUD_RATE. nico@215:
void initTimer | nico@215:( | nico@215:void | nico@215:nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 79 of file canOpenDriver.c. nico@215:
nico@215: Referenced by initSensor(), and StartTimerLoop(). nico@215:
void printSCI_nbr | nico@215:( | nico@215:char | nico@215:sci, | nico@215:|
nico@215: | nico@215: | unsigned long | nico@215:nbr, | nico@215:|
nico@215: | nico@215: | char | nico@215:lastCar | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: Print the number in hexadecimal to the serial port sci (sci takes the values SCI0 or SCI1) nico@215:
nico@215: Definition at line 179 of file canOpenDriver.c. nico@215:
nico@215: References hex_convert(), and printSCI_str(). nico@215:
etisserant@240: Here is the call graph for this function:
void printSCI_str | nico@215:( | nico@215:char | nico@215:sci, | nico@215:|
nico@215: | nico@215: | const char * | nico@215:str | nico@215: |
nico@215: | ) | nico@215:nico@215: |
nico@215: Print the string to the serial port sci (sci takes the values SCI0 or SCI1) nico@215:
nico@215: Definition at line 162 of file canOpenDriver.c. nico@215:
nico@215: References IO_PORTS_8, SCIDRL, and SCISR1. nico@215:
nico@215: Referenced by printSCI_nbr(). nico@215:
void resetTimer | nico@215:( | nico@215:void | nico@215:nico@215: | ) | nico@215:nico@215: |
nico@215: nico@215:
nico@215: Definition at line 73 of file canOpenDriver.c. nico@215:
etisserant@240: