-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
80 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
* @author Jean-François DEL NERO <[email protected]> | ||
*/ | ||
|
||
#include <stdint.h> | ||
#include <ctype.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
@@ -37,6 +38,8 @@ | |
|
||
#include "../natsort/strnatcmp.h" | ||
|
||
#include "../os_interface/os_interface.h" | ||
|
||
#include "../dbg_logs.h" | ||
#define DEBUG 1 | ||
|
||
|
@@ -870,8 +873,9 @@ int get_pins_list(jtag_core * jc,jtag_bsdl * bsdl_desc,char ** lines) | |
{ | ||
char digistr[32]; | ||
snprintf((char*)digistr,sizeof(digistr),"(%d)",tmp_start); | ||
strncat((char*)&bsdl_desc->pins_list[number_of_pins].pinname,digistr,sizeof(((pin_ctrl *)0)->pinname)-1); | ||
genos_strndstcat((char*)&bsdl_desc->pins_list[number_of_pins].pinname,digistr,sizeof(((pin_ctrl *)0)->pinname)); | ||
} | ||
bsdl_desc->pins_list[number_of_pins].pinname[sizeof(((pin_ctrl *)0)->pinname)-1] = '\0'; | ||
|
||
bsdl_desc->pins_list[number_of_pins].pintype = tmp_type; | ||
number_of_pins++; | ||
|
@@ -1299,7 +1303,9 @@ jtag_bsdl * load_bsdlfile(jtag_core * jc,char *filename) | |
|
||
/////////////////////// | ||
// copy the entity name & the file name | ||
strncpy(bsdl->entity_name,entityname,sizeof(((jtag_bsdl *)0)->entity_name) - 1); | ||
strncpy(bsdl->entity_name,entityname,sizeof(((jtag_bsdl *)0)->entity_name)); | ||
bsdl->entity_name[ sizeof(((jtag_bsdl *)0)->entity_name) - 1 ] = '\0'; | ||
|
||
i = strlen(filename); | ||
while(i && filename[i] != '\\') | ||
{ | ||
|
@@ -1309,7 +1315,8 @@ jtag_bsdl * load_bsdlfile(jtag_core * jc,char *filename) | |
if(filename[i] == '\\') | ||
i++; | ||
|
||
strncpy(bsdl->src_filename,&filename[i],sizeof(bsdl->src_filename)-1); | ||
strncpy(bsdl->src_filename,&filename[i],sizeof(bsdl->src_filename)); | ||
bsdl->src_filename[ sizeof(bsdl->src_filename) - 1 ] = '0'; | ||
|
||
/////////////////////// | ||
// Extract the chip ID | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
* @brief logs/debug output | ||
* @author Jean-François DEL NERO <[email protected]> | ||
*/ | ||
|
||
#include <stdint.h> | ||
#include <errno.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
@@ -33,6 +33,8 @@ | |
#include "jtag_core_internal.h" | ||
#include "jtag_core.h" | ||
|
||
#include "./os_interface/os_interface.h" | ||
|
||
#include "dbg_logs.h" | ||
|
||
int jtagcore_logs_printf(jtag_core * jc,int MSGTYPE,char * chaine, ...) | ||
|
@@ -73,7 +75,8 @@ int jtagcore_logs_printf(jtag_core * jc,int MSGTYPE,char * chaine, ...) | |
} | ||
|
||
vsprintf(tmp_msg2,chaine,marker); | ||
strncat(tmp_msg,tmp_msg2,sizeof(tmp_msg) - ( strlen(tmp_msg) + 1 ) ); | ||
genos_strndstcat(tmp_msg, tmp_msg2, sizeof(tmp_msg) ); | ||
tmp_msg[sizeof(tmp_msg) - 1] = '\0'; | ||
|
||
print_callback(tmp_msg); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
* @author Jean-François DEL NERO <[email protected]> | ||
*/ | ||
|
||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <sys/types.h> | ||
|
@@ -39,6 +40,8 @@ | |
|
||
#include "../../bsdl_parser/bsdl_loader.h" | ||
|
||
#include "../../os_interface/os_interface.h" | ||
|
||
#include "../../dbg_logs.h" | ||
|
||
char linux_gpio_base[512]; | ||
|
@@ -163,8 +166,9 @@ int drv_LinuxGPIO_Detect(jtag_core * jc) | |
{ | ||
jtagcore_getEnvVar( jc, "PROBE_GPIO_LINUX_BASE_FOLDER", (char*)&linux_gpio_base); | ||
|
||
strncpy(tmp_str,linux_gpio_base,sizeof(tmp_str)-1); | ||
strncat(tmp_str,"/export",sizeof(tmp_str)-1); | ||
strncpy(tmp_str,linux_gpio_base,sizeof(tmp_str)); | ||
genos_strndstcat(tmp_str,"/export",sizeof(tmp_str)); | ||
tmp_str[sizeof(tmp_str) - 1] = '\0'; | ||
|
||
f = fopen(tmp_str,"rb"); | ||
if(f) | ||
|
@@ -207,7 +211,8 @@ static int setdirGPIO(char * path_base,int pin,int dir) | |
|
||
strncpy(tmp_str,path_base,sizeof(tmp_str)-1); | ||
snprintf(tmp_str2,sizeof(tmp_str2)-1,"/gpio%d/direction",pin); | ||
strncat(tmp_str,tmp_str2,sizeof(tmp_str)-1); | ||
genos_strndstcat(tmp_str,tmp_str2,sizeof(tmp_str)); | ||
tmp_str[sizeof(tmp_str) - 1] = '\0'; | ||
|
||
f = fopen(tmp_str,"w"); | ||
if(!f) | ||
|
@@ -249,8 +254,11 @@ int drv_LinuxGPIO_Init(jtag_core * jc, int sub_drv,char * params) | |
{ | ||
gpio_var_names[i].gpio_num = jtagcore_getEnvVarValue( jc, (char*)gpio_var_names[i].name); | ||
|
||
strncpy(tmp_str,(char*)gpio_var_names[i].name,sizeof(tmp_str)-1); | ||
strncat(tmp_str,"_INVERT_POLARITY",sizeof(tmp_str)-1); | ||
strncpy(tmp_str,(char*)gpio_var_names[i].name,sizeof(tmp_str) - 1); | ||
tmp_str[sizeof(tmp_str) - 1] = '\0'; | ||
|
||
genos_strndstcat(tmp_str,"_INVERT_POLARITY",sizeof(tmp_str)); | ||
tmp_str[sizeof(tmp_str) - 1] = '\0'; | ||
|
||
gpio_var_names[i].negate_polarity = jtagcore_getEnvVarValue( jc, (char*)tmp_str); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters