Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 15:6420b52d30cc, committed 2020-05-22
- Comitter:
- jimherd
- Date:
- Fri May 22 22:53:46 2020 +0000
- Parent:
- 14:b56473e54f6f
- Child:
- 16:d69a36a541c5
- Commit message:
- FPGA unit base register pointers are now variables rather than #define constants
Changed in this revision
| FPGA_bus.cpp | Show annotated file Show diff for this revision Revisions of this file |
| FPGA_bus.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/FPGA_bus.cpp Fri May 22 16:52:10 2020 +0000
+++ b/FPGA_bus.cpp Fri May 22 22:53:46 2020 +0000
@@ -31,13 +31,20 @@
uP_ack(ASYNC_UP_ACK_PIN),
uP_handshake_2(ASYNC_UP_HANDSHAKE_2_PIN),
log_pin(LOG_PIN)
+
{
async_uP_start = LOW;
+ PWM_base = 0;
+ QE_base = 0;
+ RC_base = 0;
}
void FPGA_bus::initialise(void)
{
+
+ update_FPGA_register_pointers();
+
// GPIOC Periph clock enable
ENABLE_GPIO_SUBSYSTEM;
@@ -255,4 +262,11 @@
global_FPGA_unit_error_flag = status;
return data;
+}
+
+void FPGA_bus::update_FPGA_register_pointers(void) {
+
+ PWM_base = 1;
+ QE_base = ((NOS_PWM_REGISTERS * _nos_PWM_units) + PWM_base);
+ RC_base = ((NOS_QE_REGISTERS * _nos_QE_units) + QE_base);
}
\ No newline at end of file
--- a/FPGA_bus.h Fri May 22 16:52:10 2020 +0000
+++ b/FPGA_bus.h Fri May 22 22:53:46 2020 +0000
@@ -175,17 +175,19 @@
void enable_speed_measure(uint32_t channel, uint32_t config_value, uint32_t phase_time);
uint32_t read_speed_measure(uint32_t channel);
uint32_t read_count_measure(uint32_t channel);
+ void update_FPGA_register_pointers(void);
uint32_t get_SYS_data(void);
int32_t global_FPGA_unit_error_flag;
-protected:
+private:
uint32_t _nos_PWM_units;
uint32_t _nos_QE_units;
uint32_t _nos_servo_units;
-private:
+ uint32_t PWM_base, QE_base, RC_base;
+
uint32_t data, status, tmp_config;
received_packet_t in_pkt;