Include config.h in pregenerated rlink_speed_table.c source.
[openocd.git] / src / jtag / parport.c
index 0cfbd81f8bce6e3018d1e4a6a6c2e19e8cad5922..74c01208ff856bec76e739e53f14f16900e4f663 100644 (file)
 #include "config.h"
 #endif
 
-#include "replacements.h"
-
 #include "jtag.h"
 #include "bitbang.h"
 
-/* system includes */
 /* -ino: 060521-1036 */
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-
-#include <sys/types.h>
 #include <machine/sysarch.h>
 #include <machine/cpufunc.h>
 #define ioperm(startport,length,enable)\
   i386_set_ioperm((startport), (length), (enable))
-
-#else
-
-#ifdef _WIN32
-#include "errno.h"
-#endif /* _WIN32 */
-
 #endif /* __FreeBSD__ */
 
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
 #if PARPORT_USE_PPDEV == 1
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #include <dev/ppbus/ppi.h>
@@ -61,7 +45,6 @@
 #include <linux/parport.h>
 #include <linux/ppdev.h>
 #endif
-#include <fcntl.h>
 #include <sys/ioctl.h>
 #else /* not PARPORT_USE_PPDEV */
 #ifndef _WIN32
 #endif
 #endif
 
-#if PARPORT_USE_GIVEIO == 1
-#if IS_CYGWIN == 1
+#if PARPORT_USE_GIVEIO == 1 && IS_CYGWIN == 1
 #include <windows.h>
-#include <errno.h>
-#endif
 #endif
 
-#include "log.h"
 
 /* parallel port cable description
  */
@@ -96,7 +75,7 @@ typedef struct cable_s
        u8 LED_MASK;    /* data port bit for LED */
 } cable_t;
 
-cable_t cables[] = 
+static cable_t cables[] = 
 {      
        /* name                                 tdo   trst  tms   tck   tdi   srst  o_inv i_inv init  exit  led */
        { "wiggler",                    0x80, 0x10, 0x02, 0x04, 0x08, 0x01, 0x01, 0x80, 0x80, 0x80, 0x00 },
@@ -123,8 +102,8 @@ cable_t cables[] =
 };
 
 /* configuration */
-char* parport_cable = NULL;
-u16 parport_port;
+static char* parport_cable = NULL;
+static u16 parport_port;
 static int parport_exit = 0;
 
 /* interface variables
@@ -141,20 +120,20 @@ static unsigned long statusport;
 
 /* low level command set
  */
-int parport_read(void);
-void parport_write(int tck, int tms, int tdi);
-void parport_reset(int trst, int srst);
-void parport_led(int on);
+static int parport_read(void);
+static void parport_write(int tck, int tms, int tdi);
+static void parport_reset(int trst, int srst);
+static void parport_led(int on);
 
-int parport_speed(int speed);
-int parport_register_commands(struct command_context_s *cmd_ctx);
-int parport_init(void);
-int parport_quit(void);
+static int parport_speed(int speed);
+static int parport_register_commands(struct command_context_s *cmd_ctx);
+static int parport_init(void);
+static int parport_quit(void);
 
 /* interface commands */
-int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
+static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
 
 jtag_interface_t parport_interface = 
 {
@@ -168,7 +147,7 @@ jtag_interface_t parport_interface =
        .quit = parport_quit,
 };
 
-bitbang_interface_t parport_bitbang =
+static bitbang_interface_t parport_bitbang =
 {
        .read = parport_read,
        .write = parport_write,
@@ -176,7 +155,7 @@ bitbang_interface_t parport_bitbang =
        .blink = parport_led
 };
 
-int parport_read(void)
+static int parport_read(void)
 {
        int data = 0;
        
@@ -208,7 +187,7 @@ static __inline__ void parport_write_data(void)
 #endif
 }
 
-void parport_write(int tck, int tms, int tdi)
+static void parport_write(int tck, int tms, int tdi)
 {
        int i = jtag_speed + 1;
        
@@ -232,7 +211,7 @@ void parport_write(int tck, int tms, int tdi)
 }
 
 /* (1) assert or (0) deassert reset lines */
-void parport_reset(int trst, int srst)
+static void parport_reset(int trst, int srst)
 {
        LOG_DEBUG("trst: %i, srst: %i", trst, srst);
 
@@ -250,7 +229,7 @@ void parport_reset(int trst, int srst)
 }
        
 /* turn LED on parport adapter on (1) or off (0) */
-void parport_led(int on)
+static void parport_led(int on)
 {
        if (on)
                dataport_value |= cable->LED_MASK;
@@ -260,25 +239,25 @@ void parport_led(int on)
        parport_write_data();
 }
 
-int parport_speed(int speed)
+static int parport_speed(int speed)
 {
        return ERROR_OK;
 }
 
-int parport_register_commands(struct command_context_s *cmd_ctx)
+static int parport_register_commands(struct command_context_s *cmd_ctx)
 {
        register_command(cmd_ctx, NULL, "parport_port", parport_handle_parport_port_command,
-               COMMAND_CONFIG, NULL);
+               COMMAND_CONFIG, "either the address of the I/O port or the number of the \91/dev/parport\92 device");
        register_command(cmd_ctx, NULL, "parport_cable", parport_handle_parport_cable_command,
-               COMMAND_CONFIG, NULL);
+               COMMAND_CONFIG, "the layout of the parallel port cable used to connect to the target");
        register_command(cmd_ctx, NULL, "parport_write_on_exit", parport_handle_write_on_exit_command,
-               COMMAND_CONFIG, NULL);
+               COMMAND_CONFIG, "configure the parallel driver to write a known value to the parallel interface");
 
        return ERROR_OK;
 }
 
 #if PARPORT_USE_GIVEIO == 1
-int parport_get_giveio_access(void)
+static int parport_get_giveio_access(void)
 {
        HANDLE h;
        OSVERSIONINFO version;
@@ -303,7 +282,7 @@ int parport_get_giveio_access(void)
 }
 #endif
 
-int parport_init(void)
+static int parport_init(void)
 {
        cable_t *cur_cable;
 #if PARPORT_USE_PPDEV == 1
@@ -429,7 +408,7 @@ int parport_init(void)
        return ERROR_OK;
 }
 
-int parport_quit(void)
+static int parport_quit(void)
 {
        parport_led(0);
 
@@ -448,7 +427,7 @@ int parport_quit(void)
        return ERROR_OK;
 }
 
-int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
 {
        if (argc == 0)
                return ERROR_OK;
@@ -460,7 +439,7 @@ int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char
        return ERROR_OK;
 }
 
-int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
 {
        if (argc == 0)
                return ERROR_OK;
@@ -475,7 +454,7 @@ int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char
        return ERROR_OK;
 }
 
-int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
+static int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
 {
        if (argc != 1)
        {

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)