![]() |
ATxmega Core
|
#include "cpu.h"
#include "hwbp_core.h"
#include "hwbp_core_regs.h"
#include "hwbp_core_types.h"
#include "hwbp_core_com.h"
#include "hwbp_sync.h"
Macros | |
#define | VH 1 |
#define | VL 14 |
#define | CMD_READ 0x01 |
#define | CMD_READ_OK 0x01 |
#define | CMD_READ_ERROR 0x09 |
#define | CMD_WRITE 0x02 |
#define | CMD_WRITE_OK 0x02 |
#define | CMD_WRITE_ERROR 0x0A |
#define | EVENT 0x03 |
#define | F_CPU 32000000 |
#define | EEPROM_ADD_MEM_IN_USE 0 |
#define | EEPROM_ADD_R_OPERATION_CTRL 1 |
#define | EEPROM_ADD_R_FW_VERSION_H 2 |
#define | EEPROM_ADD_R_CORE_VERSION_H 3 |
#define | EEPROM_ADD_SN_HIGH 4 |
#define | EEPROM_ADD_SN_LOW 5 |
#define | EEPROM_ADD_CLOCK_CONFIG 6 |
#define | EEPROM_ADD_R_DEVICE_NAME 7 |
#define | EEPROM_ADD_APP_REG 32 |
#define | R_DEVICE_NAME_SIZE 25 |
#define | EEPROM_RST_USE_REGS_DEF 0xDF |
#define | EEPROM_RST_USE_REGS_EE 0xEE |
#define | CTS_TIMEOUT_MS 3000 |
#define | check_checksum(array, leng, checksum_) |
Functions | |
static void | parse_and_reply (uint8_t *packet_p, uint16_t len) |
static void | xmit_error (uint8_t header, uint8_t *packet) |
static void | xmit (uint8_t add, uint8_t header, bool use_core_timestamp) |
static void | write_device_name_to_eeprom (const uint8_t *dev_name) |
static void | read_device_name_to_register (void) |
void | core_func_start_core (const uint16_t who_am_i, const uint8_t hwH, const uint8_t hwL, const uint8_t fwH, const uint8_t fwL, const uint8_t assembly, uint8_t *pointer_to_app_regs, const uint16_t app_mem_size_to_save, const uint8_t num_of_app_registers, const uint8_t *device_name, const bool device_is_able_to_repeat_clock, const bool device_is_able_to_generate_clock, const uint8_t default_timestamp_offset) |
It is mandatory that this function is the first of the application code. | |
void | core_func_catastrophic_error_detected (void) |
ISR (TCC1_OVF_vect, ISR_NAKED) | |
ISR (TCC1_CCA_vect, ISR_NAKED) | |
void | core_func_update_user_timestamp (uint32_t seconds, uint16_t useconds) |
Used to create a specific timestamp that can be used when sending Events. | |
void | core_func_read_user_timestamp (uint32_t *seconds, uint16_t *useconds) |
Used to read the current user timestamps. | |
void | core_func_mark_user_timestamp (void) |
Used to save the current timestamp. | |
void | core_func_send_event (uint8_t add, bool use_core_timestamp) |
Used to send an Event. | |
bool | hwbp_read_common_reg (uint8_t add, uint8_t type) |
Read from a common register. | |
bool | hwbp_write_common_reg (uint8_t add, uint8_t type, uint8_t *content, uint16_t n_elements) |
Write to an common register. | |
bool | core_save_all_registers_to_eeprom (void) |
Used to save all registers to non-volatile memory. | |
bool | hwbp_write_common_reg_RESET_APP (void *a) |
Write to common register RESET_APP. | |
bool | core_bool_device_is_repeater (void) |
Used to know if the device is repeating the harp timestamp clock. | |
bool | core_bool_device_is_generator (void) |
Used to know if the device is generating the harp timestamp clock. | |
bool | core_bool_clock_is_locked (void) |
Used to check if the timestamp register is locked. | |
bool | core_device_to_clock_repeater (void) |
Used to set the device as a repeater. | |
bool | core_device_to_clock_generator (void) |
Used to set the device as a generator. | |
bool | core_clock_to_lock (void) |
Used to lock the timestamp register. | |
bool | core_clock_to_unlock (void) |
Used to unlock the timestamp register. | |
void | hwbp_read_common_reg_CONFIG (void) |
Read from common register CONFIG. | |
bool | hwbp_write_common_reg_CONFIG (void *a) |
Write to common register CONFIG. | |
uint32_t | core_func_read_R_TIMESTAMP_SECOND (void) |
Used to get the content of register R_TIMESTAMP_SECOND. | |
uint16_t | core_func_read_R_TIMESTAMP_MICRO (void) |
Used to get the content of register R_TIMESTAMP_MICRO. | |
void | core_func_leave_speed_mode_and_go_to_standby_mode (void) |
Used to leave the speed mode. | |
bool | core_bool_is_visual_enabled (void) |
Return "true" if the LEDs can be ON. | |
bool | core_bool_speed_mode_is_in_use (void) |
Return "true" if the device is in Speed Mode. | |
bool | core_bool_device_is_active (void) |
Return "true" if the device is in Active Mode. | |
bool | core_bool_device_is_synchronized (void) |
Return "true" if the device is synchronized. | |
#define check_checksum | ( | array, | |
leng, | |||
checksum_ ) |
#define CMD_READ 0x01 |
#define CMD_READ_ERROR 0x09 |
#define CMD_READ_OK 0x01 |
#define CMD_WRITE 0x02 |
#define CMD_WRITE_ERROR 0x0A |
#define CMD_WRITE_OK 0x02 |
#define CTS_TIMEOUT_MS 3000 |
#define EEPROM_ADD_APP_REG 32 |
#define EEPROM_ADD_CLOCK_CONFIG 6 |
#define EEPROM_ADD_MEM_IN_USE 0 |
#define EEPROM_ADD_R_CORE_VERSION_H 3 |
#define EEPROM_ADD_R_DEVICE_NAME 7 |
#define EEPROM_ADD_R_FW_VERSION_H 2 |
#define EEPROM_ADD_R_OPERATION_CTRL 1 |
#define EEPROM_ADD_SN_HIGH 4 |
#define EEPROM_ADD_SN_LOW 5 |
#define EEPROM_RST_USE_REGS_DEF 0xDF |
#define EEPROM_RST_USE_REGS_EE 0xEE |
#define EVENT 0x03 |
#define F_CPU 32000000 |
#define R_DEVICE_NAME_SIZE 25 |
#define VH 1 |
#define VL 14 |
bool core_bool_clock_is_locked | ( | void | ) |
Used to check if the timestamp register is locked.
bool core_bool_device_is_active | ( | void | ) |
Return "true" if the device is in Active Mode.
bool core_bool_device_is_generator | ( | void | ) |
Used to know if the device is generating the harp timestamp clock.
bool core_bool_device_is_repeater | ( | void | ) |
Used to know if the device is repeating the harp timestamp clock.
bool core_bool_device_is_synchronized | ( | void | ) |
Return "true" if the device is synchronized.
bool core_bool_is_visual_enabled | ( | void | ) |
Return "true" if the LEDs can be ON.
bool core_bool_speed_mode_is_in_use | ( | void | ) |
Return "true" if the device is in Speed Mode.
bool core_clock_to_lock | ( | void | ) |
Used to lock the timestamp register.
bool core_clock_to_unlock | ( | void | ) |
Used to unlock the timestamp register.
bool core_device_to_clock_generator | ( | void | ) |
Used to set the device as a generator.
bool core_device_to_clock_repeater | ( | void | ) |
Used to set the device as a repeater.
void core_func_catastrophic_error_detected | ( | void | ) |
Call this function in case of error A power up or reset must be performed to remove the device from this state
void core_func_leave_speed_mode_and_go_to_standby_mode | ( | void | ) |
Used to leave the speed mode.
void core_func_mark_user_timestamp | ( | void | ) |
Used to save the current timestamp.
uint16_t core_func_read_R_TIMESTAMP_MICRO | ( | void | ) |
Used to get the content of register R_TIMESTAMP_MICRO.
uint32_t core_func_read_R_TIMESTAMP_SECOND | ( | void | ) |
Used to get the content of register R_TIMESTAMP_SECOND.
void core_func_read_user_timestamp | ( | uint32_t * | seconds, |
uint16_t * | useconds ) |
Used to read the current user timestamps.
void core_func_send_event | ( | uint8_t | add, |
bool | use_core_timestamp ) |
Used to send an Event.
void core_func_start_core | ( | const uint16_t | who_am_i, |
const uint8_t | hwH, | ||
const uint8_t | hwL, | ||
const uint8_t | fwH, | ||
const uint8_t | fwL, | ||
const uint8_t | assembly, | ||
uint8_t * | pointer_to_app_regs, | ||
const uint16_t | app_mem_size_to_save, | ||
const uint8_t | num_of_app_registers, | ||
const uint8_t * | device_name, | ||
const bool | device_is_able_to_repeat_clock, | ||
const bool | device_is_able_to_generate_clock, | ||
const uint8_t | default_timestamp_offset ) |
It is mandatory that this function is the first of the application code.
void core_func_update_user_timestamp | ( | uint32_t | seconds, |
uint16_t | useconds ) |
Used to create a specific timestamp that can be used when sending Events.
bool core_save_all_registers_to_eeprom | ( | void | ) |
Used to save all registers to non-volatile memory.
bool hwbp_read_common_reg | ( | uint8_t | add, |
uint8_t | type ) |
Read from a common register.
void hwbp_read_common_reg_CONFIG | ( | void | ) |
Read from common register CONFIG.
bool hwbp_write_common_reg | ( | uint8_t | add, |
uint8_t | type, | ||
uint8_t * | content, | ||
uint16_t | n_elements ) |
Write to an common register.
bool hwbp_write_common_reg_CONFIG | ( | void * | a | ) |
Write to common register CONFIG.
bool hwbp_write_common_reg_RESET_APP | ( | void * | a | ) |
Write to common register RESET_APP.
ISR | ( | TCC1_CCA_vect | , |
ISR_NAKED | ) |
ISR | ( | TCC1_OVF_vect | , |
ISR_NAKED | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
struct CommonBank commonbank |
|
static |
|
static |
|
static |
uint16_t CTS_timeout_counter = 0 |
|
static |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
static |
|
static |
|
static |
|
static |
uint8_t reply_buff[MAX_PACKET_SIZE] |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
static |
|
static |
|
static |
|
static |
|
static |