Skip to content

Commit

Permalink
Revert "X86 interrupts (#14)"
Browse files Browse the repository at this point in the history
This reverts commit b98315e.
  • Loading branch information
Akashem06 committed Dec 31, 2024
1 parent b98315e commit c2be979
Show file tree
Hide file tree
Showing 88 changed files with 122 additions and 3,816 deletions.
6 changes: 5 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,17 @@ elif COMMAND == "new":
SConscript('scons/new_target.scons', exports='VARS')

###########################################################
# HIL command
# hil command
###########################################################
elif COMMAND == "hil":
print(TEST_FILE)
if not TEST_FILE:
#Error handling
pass

SConscript('scons/pytest.scons', exports='VARS')


###########################################################
# Clean
###########################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ extern rx_struct g_rx_struct;
extern tx_struct g_tx_struct;

void can_tx_all();
void can_tx_fast_cycle();
void can_tx_medium_cycle();
void can_tx_slow_cycle();

void can_rx_all();

/** @} */
95 changes: 5 additions & 90 deletions autogen/templates/project_can/src/{{project_name}}_rx_all.c.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -53,111 +53,26 @@ void can_rx_all() {
}
}

void clear_all_rx_received() {
void clear_rx_received() {
{%- for message in messages %}
g_rx_struct.received_{{message.name}} = false;
{%- endfor %}
}

void clear_fast_rx_received() {
{%- for message in messages %}
{%- if message.cycle == "fast" %}
g_rx_struct.received_{{message.name}} = false;
{%- endif %}
{%- endfor %}
}

void clear_medium_rx_received() {
{%- for message in messages %}
{%- if message.cycle == "medium" %}
g_rx_struct.received_{{message.name}} = false;
{%- endif %}
{%- endfor %}
}

void clear_slow_rx_received() {
{%- for message in messages %}
{%- if message.cycle == "slow" %}
g_rx_struct.received_{{message.name}} = false;
{%- endif %}
{%- endfor %}
}

StatusCode check_all_can_watchdogs() {
StatusCode check_can_watchdogs() {
{%- for message in messages %}
{%- if message.receiver[project_name].watchdog != 0 %}
if (!g_rx_struct.received_{{message.name}}) {
++s_{{message.name}}_msg_watchdog.cycles_over;
if (s_{{message.name}}_msg_watchdog.cycles_over >= s_{{message.name}}_msg_watchdog.max_cycles) {
LOG_CRITICAL("DID NOT RECEIVE CAN MESSAGE: %u IN MAX CYCLES : %u\n", SYSTEM_CAN_MESSAGE_{{message.sender | upper}}_{{message.name | upper}},
s_{{message.name}}_msg_watchdog.max_cycles);
s_{{message.name}}_msg_watchdog.missed = true;
s_{{message.name}}_msg_watchdog.missed = 1;
} else {
s_{{message.name}}_msg_watchdog.missed = false;
s_{{message.name}}_msg_watchdog.missed = 0;
}
}
{%- endif %}
{%- endfor %}
return STATUS_CODE_OK;
}

StatusCode check_fast_can_watchdogs() {
{%- for message in messages %}
{%- if message.cycle == "fast" %}
{%- if message.receiver[project_name].watchdog != 0 %}
if (!g_rx_struct.received_{{message.name}}) {
++s_{{message.name}}_msg_watchdog.cycles_over;
if (s_{{message.name}}_msg_watchdog.cycles_over >= s_{{message.name}}_msg_watchdog.max_cycles) {
LOG_CRITICAL("DID NOT RECEIVE FAST CYCLE CAN MESSAGE: %u IN MAX CYCLES : %u\n", SYSTEM_CAN_MESSAGE_{{message.sender | upper}}_{{message.name | upper}},
s_{{message.name}}_msg_watchdog.max_cycles);
s_{{message.name}}_msg_watchdog.missed = true;
} else {
s_{{message.name}}_msg_watchdog.missed = false;
}
}
{%- endif %}
{%- endif %}
{%- endfor %}
return STATUS_CODE_OK;
}

StatusCode check_medium_can_watchdogs() {
{%- for message in messages %}
{%- if message.cycle == "medium" %}
{%- if message.receiver[project_name].watchdog != 0 %}
if (!g_rx_struct.received_{{message.name}}) {
++s_{{message.name}}_msg_watchdog.cycles_over;
if (s_{{message.name}}_msg_watchdog.cycles_over >= s_{{message.name}}_msg_watchdog.max_cycles) {
LOG_CRITICAL("DID NOT RECEIVE MEDIUM CYCLE CAN MESSAGE: %u IN MAX CYCLES : %u\n", SYSTEM_CAN_MESSAGE_{{message.sender | upper}}_{{message.name | upper}},
s_{{message.name}}_msg_watchdog.max_cycles);
s_{{message.name}}_msg_watchdog.missed = true;
} else {
s_{{message.name}}_msg_watchdog.missed = false;
}
}
{%- endif %}
{%- endif %}
{%- endfor %}
return STATUS_CODE_OK;
}

StatusCode check_slow_can_watchdogs() {
{%- for message in messages %}
{%- if message.cycle == "slow" %}
{%- if message.receiver[project_name].watchdog != 0 %}
if (!g_rx_struct.received_{{message.name}}) {
++s_{{message.name}}_msg_watchdog.cycles_over;
if (s_{{message.name}}_msg_watchdog.cycles_over >= s_{{message.name}}_msg_watchdog.max_cycles) {
LOG_CRITICAL("DID NOT RECEIVE SLOW CAN MESSAGE: %u IN MAX CYCLES : %u\n", SYSTEM_CAN_MESSAGE_{{message.sender | upper}}_{{message.name | upper}},
s_{{message.name}}_msg_watchdog.max_cycles);
s_{{message.name}}_msg_watchdog.missed = true;
} else {
s_{{message.name}}_msg_watchdog.missed = false;
}
}
{%- endif %}
{%- endif %}
{%- endfor %}
return STATUS_CODE_OK;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
/* Intra-component Headers */
#include "can_codegen.h"
{% set messages = messages | selectattr("sender", "eq", project_name) | list -%}

static CanMessage s_msg = { 0U };

static void prv_tx_can_message(CanMessageId id, uint8_t num_bytes, uint64_t data) {
Expand All @@ -38,46 +37,4 @@ void can_tx_all() {
{%- endfor -%}
);
{%- endfor %}
}

void can_tx_fast_cycle() {
{%- for message in messages %}
{%- if message.cycle == "fast" %}
prv_tx_can_message(
SYSTEM_CAN_MESSAGE_{{message.sender | upper}}_{{message.name | upper}},
{{- (message.signals | sum(attribute='length') / 8) | int }},
{%- for signal in message.signals %}
(uint64_t) g_tx_struct.{{message.name}}_{{signal.name}} << {{signal.start_bit}}{{ " |" if not loop.last }}
{%- endfor -%}
);
{%- endif %}
{%- endfor %}
}

void can_tx_medium_cycle() {
{%- for message in messages %}
{%- if message.cycle == "medium" %}
prv_tx_can_message(
SYSTEM_CAN_MESSAGE_{{message.sender | upper}}_{{message.name | upper}},
{{- (message.signals | sum(attribute='length') / 8) | int }},
{%- for signal in message.signals %}
(uint64_t) g_tx_struct.{{message.name}}_{{signal.name}} << {{signal.start_bit}}{{ " |" if not loop.last }}
{%- endfor -%}
);
{%- endif %}
{%- endfor %}
}

void can_tx_slow_cycle() {
{%- for message in messages %}
{%- if message.cycle == "slow" %}
prv_tx_can_message(
SYSTEM_CAN_MESSAGE_{{message.sender | upper}}_{{message.name | upper}},
{{- (message.signals | sum(attribute='length') / 8) | int }},
{%- for signal in message.signals %}
(uint64_t) g_tx_struct.{{message.name}}_{{signal.name}} << {{signal.start_bit}}{{ " |" if not loop.last }}
{%- endfor -%}
);
{%- endif %}
{%- endfor %}
}
}
2 changes: 1 addition & 1 deletion autogen/templates/system_can/system_can.h.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ typedef enum {

{% for message in messages %}
#define SYSTEM_CAN_MESSAGE_{{ message.sender | upper }}_{{ message.name | upper }} \
{% if not message.critical %} SYSTEM_CAN_MESSAGE_PRIORITY_BIT + {% endif %}({{ message.id }} << SYSTEM_CAN_MESSAGE_ID_OFFSET) + SYSTEM_CAN_DEVICE_{{ message.sender | upper }}
{% if not message.critical %} SYSTEM_CAN_MESSAGE_PRIORITY_BIT + {% endif %}({{ message.id }} << CAN_MESSAGE_ID_OFFSET) + SYSTEM_CAN_DEVICE_{{ message.sender | upper }}
{% endfor %}
/** @} */
7 changes: 0 additions & 7 deletions build_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ Commands:
(x86) Run the project's binary.
- e.g. `scons sim --platform=x86 <target>` (`scons sim --platform=x86 --project=new_led`)
vehicle_sim
(x86) Runs a full vehicle simulation
- e.g. 'scons vehicle_sim --platform=x86'
gdb
(x86) Run the project's binary with gdb.
- e.g. `scons gdb <target>` (`scons gdb --project=new_led`)
Expand All @@ -88,9 +84,6 @@ Commands:
clean
Delete the `build` directory.
hil
Runs a HIL test. This is not fully implemented yet
doxygen
Build a local copy of the doxygen HTML
Expand Down
42 changes: 21 additions & 21 deletions can/boards/bms_carrier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,8 @@
afe_status:
length: 8

battery_vt:
id: 2
critical: true
cycle: "fast"
target:
centre_console:
watchdog: 0
signals:
voltage:
length: 16
current:
length: 16
temperature:
length: 16
batt_perc:
length: 16

battery_info:
id: 3
id: 14
critical: true
cycle: "slow"
target:
Expand All @@ -59,10 +42,27 @@
min_cell_v:
length: 16

battery_vt:
id: 15
critical: true
cycle: "fast"
target:
centre_console:
watchdog: 0
signals:
voltage:
length: 16
current:
length: 16
temperature:
length: 16
batt_perc:
length: 16

AFE1_status:
id: 61
critical: false
cycle: "slow"
cycle: "medium"
target:
centre_console:
watchdog: 0
Expand All @@ -83,7 +83,7 @@
AFE2_status:
id: 62
critical: false
cycle: "slow"
cycle: "medium"
target:
centre_console:
watchdog: 0
Expand All @@ -104,7 +104,7 @@
AFE3_status:
id: 63
critical: false
cycle: "slow"
cycle: "medium"
target:
centre_console:
watchdog: 0
Expand Down
44 changes: 0 additions & 44 deletions can/boards/can_communication.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions can/boards/centre_console.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
---
Messages:
cc_pedal:
id: 4
id: 2
critical: true
cycle: "fast"
target:
Expand Down Expand Up @@ -58,7 +58,7 @@ Messages:
length: 8

cc_regen_percentage:
id: 7
id: 8
critical: true
cycle: "medium"
target:
Expand Down
Loading

0 comments on commit c2be979

Please sign in to comment.