diff options
author | David Sidrane <david_s5@nscdg.com> | 2015-04-17 15:52:09 -1000 |
---|---|---|
committer | David Sidrane <david_s5@nscdg.com> | 2015-04-22 02:30:13 -1000 |
commit | d5cf0ec899ca2b47e6017a8d11c668cd1fd84cf7 (patch) | |
tree | 77a19f6435ab69bd52fa854c5aab0e876e810bd9 /src/drivers/boards/px4cannode-v1/bootloader/can/driver.h | |
parent | 7e7877b372c3c35a8f6150379aad896e5cdba72e (diff) | |
download | px4-firmware-d5cf0ec899ca2b47e6017a8d11c668cd1fd84cf7.tar.gz px4-firmware-d5cf0ec899ca2b47e6017a8d11c668cd1fd84cf7.tar.bz2 px4-firmware-d5cf0ec899ca2b47e6017a8d11c668cd1fd84cf7.zip |
Moved Nuttx Based uavcan bootloader ito PX4 tree
Diffstat (limited to 'src/drivers/boards/px4cannode-v1/bootloader/can/driver.h')
-rw-r--r-- | src/drivers/boards/px4cannode-v1/bootloader/can/driver.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/drivers/boards/px4cannode-v1/bootloader/can/driver.h b/src/drivers/boards/px4cannode-v1/bootloader/can/driver.h new file mode 100644 index 000000000..138e14ba3 --- /dev/null +++ b/src/drivers/boards/px4cannode-v1/bootloader/can/driver.h @@ -0,0 +1,47 @@ +#pragma once + +#include "timer.h" + +typedef enum +{ + CAN_UNKNOWN = 0, + CAN_125KBAUD = 1, + CAN_250KBAUD = 2, + CAN_500KBAUD = 3, + CAN_1MBAUD = 4 +} can_speed_t; + +typedef enum +{ + CAN_Mode_Normal = 0, // Bits 30 and 31 00 + CAN_Mode_LoopBack = 1, // Bit 30: Loop Back Mode (Debug) + CAN_Mode_Silent = 2, // Bit 31: Silent Mode (Debug) + CAN_Mode_Silent_LoopBack = 3 // Bits 30 and 31 11 +} can_mode_t; + +typedef enum +{ + fifoAll = 0, + MBAll = 0, + /* + Receive from FIFO 1 -- filters are configured to push the messages there, + and this is called from SysTick so needs to avoid the same FIFOs/mailboxes + as the rest of the application. + */ + + fifoGetNodeInfo = 1, + MBGetNodeInfo = 1, + MBNodeStatus = 1, + + +} can_fifo_mailbox_t; + +void can_tx(uint32_t message_id, size_t length, + const uint8_t * message, uint8_t mailbox); +uint8_t can_rx(uint32_t * out_message_id, size_t * out_length, + uint8_t * out_message, uint8_t fifo); +int can_init(can_speed_t speed, can_mode_t mode); +int can_autobaud(can_speed_t *can_speed, bl_timer_id tboot); + +int can_speed2freq(can_speed_t); +can_speed_t can_freq2speed(int freq); |