Skip to content

Commit df7a294

Browse files
authored
Merge pull request #3407 from BsAtHome/backport-fix_hm2-constify
Backport: Various cleanup of hostmot2
2 parents a3032d8 + 62740bc commit df7a294

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

src/hal/drivers/mesa-hostmot2/hostmot2.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ static void hm2_write(void *void_hm2, long period) {
156156
hm2_pwmgen_write(hm2); // update pwmgen registers if needed
157157
hm2_oneshot_write(hm2); // update oneshot registers if needed
158158
hm2_rcpwmgen_write(hm2); // update rcpwmgen registers if needed
159+
hm2_pktuart_write(hm2); // update pktuart registers if needed
159160
hm2_inmux_write(hm2); // update inmux control register if needed
160161
hm2_inm_write(hm2); // update inm control register if needed
161162
hm2_xy2mod_write(hm2); // update xy2mod motion registers if needed
@@ -220,7 +221,7 @@ const char *hm2_hz_to_mhz(rtapi_u32 freq_hz) {
220221

221222
// FIXME: It would be nice if this was more generic
222223
EXPORT_SYMBOL_GPL(hm2_get_bspi);
223-
int hm2_get_bspi(hostmot2_t** hm2, char *name){
224+
int hm2_get_bspi(hostmot2_t** hm2, const char *name){
224225
struct rtapi_list_head *ptr;
225226
int i;
226227
rtapi_list_for_each(ptr, &hm2_list) {
@@ -235,7 +236,7 @@ int hm2_get_bspi(hostmot2_t** hm2, char *name){
235236
}
236237

237238
EXPORT_SYMBOL_GPL(hm2_get_uart);
238-
int hm2_get_uart(hostmot2_t** hm2, char *name){
239+
int hm2_get_uart(hostmot2_t** hm2, const char *name){
239240
struct rtapi_list_head *ptr;
240241
int i;
241242
rtapi_list_for_each(ptr, &hm2_list) {
@@ -249,7 +250,7 @@ int hm2_get_uart(hostmot2_t** hm2, char *name){
249250
return -1;
250251
}
251252
EXPORT_SYMBOL_GPL(hm2_get_pktuart);
252-
int hm2_get_pktuart(hostmot2_t** hm2, char *name){
253+
int hm2_get_pktuart(hostmot2_t** hm2, const char *name){
253254
struct rtapi_list_head *ptr;
254255
int i;
255256
rtapi_list_for_each(ptr, &hm2_list) {
@@ -264,7 +265,7 @@ int hm2_get_pktuart(hostmot2_t** hm2, char *name){
264265
}
265266
EXPORT_SYMBOL_GPL(hm2_get_sserial);
266267
// returns a pointer to a remote struct
267-
hm2_sserial_remote_t *hm2_get_sserial(hostmot2_t** hm2, char *name){
268+
hm2_sserial_remote_t *hm2_get_sserial(hostmot2_t** hm2, const char *name){
268269
// returns inst * 64 + remote index
269270
struct rtapi_list_head *ptr;
270271
int i, j;
@@ -1141,6 +1142,7 @@ static void hm2_cleanup(hostmot2_t *hm2) {
11411142
hm2_outm_cleanup(hm2);
11421143
hm2_oneshot_cleanup(hm2);
11431144
hm2_rcpwmgen_cleanup(hm2);
1145+
hm2_pktuart_cleanup(hm2);
11441146

11451147
// free all the tram entries
11461148
hm2_tram_cleanup(hm2);
@@ -1167,6 +1169,7 @@ void hm2_print_modules(hostmot2_t *hm2) {
11671169
hm2_inm_print_module(hm2);
11681170
hm2_xy2mod_print_module(hm2);
11691171
hm2_rcpwmgen_print_module(hm2);
1172+
hm2_pktuart_print_module(hm2);
11701173
}
11711174

11721175

src/hal/drivers/mesa-hostmot2/hostmot2.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,10 +1669,10 @@ const char *hm2_hz_to_mhz(rtapi_u32 freq_hz);
16691669
void hm2_print_modules(hostmot2_t *hm2);
16701670

16711671
// functions to get handles to components by name
1672-
hm2_sserial_remote_t *hm2_get_sserial(hostmot2_t **hm2, char *name);
1673-
int hm2_get_bspi(hostmot2_t **hm2, char *name);
1674-
int hm2_get_uart(hostmot2_t **hm2, char *name);
1675-
int hm2_get_pktuart(hostmot2_t **hm2, char *name);
1672+
hm2_sserial_remote_t *hm2_get_sserial(hostmot2_t **hm2, const char *name);
1673+
int hm2_get_bspi(hostmot2_t **hm2, const char *name);
1674+
int hm2_get_uart(hostmot2_t **hm2, const char *name);
1675+
int hm2_get_pktuart(hostmot2_t **hm2, const char *name);
16761676

16771677

16781678
//

src/hal/drivers/mesa-hostmot2/pins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ const char* hm2_get_pin_secondary_hal_name(const hm2_pin_t *pin) {
641641
case HM2_GTAG_UART_TX:
642642
switch (sec_pin) {
643643
case 0x1: return "tx";
644-
case 0x2: return "tx-drive-enable";
644+
case 0x2: return "tx-drv-en";
645645
}
646646
break;
647647

@@ -653,7 +653,7 @@ const char* hm2_get_pin_secondary_hal_name(const hm2_pin_t *pin) {
653653
case HM2_GTAG_PKTUART_TX:
654654
switch (sec_pin) {
655655
case 0x1: return "tx";
656-
case 0x2: return "tx-drive-enable";
656+
case 0x2: return "tx-drv-en";
657657
}
658658
break;
659659

0 commit comments

Comments
 (0)