forked from Imagelibrary/rtems
Whitespace removal.
This commit is contained in:
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
/* libi2c Implementation */
|
/* libi2c Implementation */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Authorship
|
* Authorship
|
||||||
* ----------
|
* ----------
|
||||||
* This software was created by
|
* This software was created by
|
||||||
* Till Straumann <strauman@slac.stanford.edu>, 2005,
|
* Till Straumann <strauman@slac.stanford.edu>, 2005,
|
||||||
* Stanford Linear Accelerator Center, Stanford University.
|
* Stanford Linear Accelerator Center, Stanford University.
|
||||||
*
|
*
|
||||||
* Acknowledgement of sponsorship
|
* Acknowledgement of sponsorship
|
||||||
* ------------------------------
|
* ------------------------------
|
||||||
* This software was produced by
|
* This software was produced by
|
||||||
* the Stanford Linear Accelerator Center, Stanford University,
|
* the Stanford Linear Accelerator Center, Stanford University,
|
||||||
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
|
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
|
||||||
*
|
*
|
||||||
* Government disclaimer of liability
|
* Government disclaimer of liability
|
||||||
* ----------------------------------
|
* ----------------------------------
|
||||||
* Neither the United States nor the United States Department of Energy,
|
* Neither the United States nor the United States Department of Energy,
|
||||||
@@ -23,18 +23,18 @@
|
|||||||
* completeness, or usefulness of any data, apparatus, product, or process
|
* completeness, or usefulness of any data, apparatus, product, or process
|
||||||
* disclosed, or represents that its use would not infringe privately owned
|
* disclosed, or represents that its use would not infringe privately owned
|
||||||
* rights.
|
* rights.
|
||||||
*
|
*
|
||||||
* Stanford disclaimer of liability
|
* Stanford disclaimer of liability
|
||||||
* --------------------------------
|
* --------------------------------
|
||||||
* Stanford University makes no representations or warranties, express or
|
* Stanford University makes no representations or warranties, express or
|
||||||
* implied, nor assumes any liability for the use of this software.
|
* implied, nor assumes any liability for the use of this software.
|
||||||
*
|
*
|
||||||
* Stanford disclaimer of copyright
|
* Stanford disclaimer of copyright
|
||||||
* --------------------------------
|
* --------------------------------
|
||||||
* Stanford University, owner of the copyright, hereby disclaims its
|
* Stanford University, owner of the copyright, hereby disclaims its
|
||||||
* copyright and all other rights in this software. Hence, anyone may
|
* copyright and all other rights in this software. Hence, anyone may
|
||||||
* freely use it for any purpose without restriction.
|
* freely use it for any purpose without restriction.
|
||||||
*
|
*
|
||||||
* Maintenance of notices
|
* Maintenance of notices
|
||||||
* ----------------------
|
* ----------------------
|
||||||
* In the interest of clarity regarding the origin and status of this
|
* In the interest of clarity regarding the origin and status of this
|
||||||
@@ -43,11 +43,11 @@
|
|||||||
* or distributed by the recipient and are to be affixed to any copy of
|
* or distributed by the recipient and are to be affixed to any copy of
|
||||||
* software made or distributed by the recipient that contains a copy or
|
* software made or distributed by the recipient that contains a copy or
|
||||||
* derivative of this software.
|
* derivative of this software.
|
||||||
*
|
*
|
||||||
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
|
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* adaptations to also handle SPI devices
|
* adaptations to also handle SPI devices
|
||||||
* by Thomas Doerfler, embedded brains GmbH, Puchheim, Germany
|
* by Thomas Doerfler, embedded brains GmbH, Puchheim, Germany
|
||||||
*/
|
*/
|
||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
@@ -357,7 +357,7 @@ rtems_libi2c_initialize (void)
|
|||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rtems_io_register_driver does NOT currently check nor report back
|
/* rtems_io_register_driver does NOT currently check nor report back
|
||||||
* the return code of the 'init' operation, so we cannot
|
* the return code of the 'init' operation, so we cannot
|
||||||
* rely on return code since it may seem OK even if the driver 'init;
|
* rely on return code since it may seem OK even if the driver 'init;
|
||||||
@@ -534,8 +534,8 @@ rtems_libi2c_send_addr (rtems_device_minor_number minor, int rw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rtems_libi2c_read_bytes (rtems_device_minor_number minor,
|
rtems_libi2c_read_bytes (rtems_device_minor_number minor,
|
||||||
unsigned char *bytes,
|
unsigned char *bytes,
|
||||||
int nbytes)
|
int nbytes)
|
||||||
{
|
{
|
||||||
int sc;
|
int sc;
|
||||||
@@ -551,8 +551,8 @@ rtems_libi2c_read_bytes (rtems_device_minor_number minor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rtems_libi2c_write_bytes (rtems_device_minor_number minor,
|
rtems_libi2c_write_bytes (rtems_device_minor_number minor,
|
||||||
const unsigned char *bytes,
|
const unsigned char *bytes,
|
||||||
int nbytes)
|
int nbytes)
|
||||||
{
|
{
|
||||||
int sc;
|
int sc;
|
||||||
@@ -568,7 +568,7 @@ rtems_libi2c_write_bytes (rtems_device_minor_number minor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
||||||
int cmd,
|
int cmd,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
@@ -577,15 +577,15 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
|||||||
void *args;
|
void *args;
|
||||||
bool is_started = false;
|
bool is_started = false;
|
||||||
DECL_CHECKED_BH (busno, bush, minor, -)
|
DECL_CHECKED_BH (busno, bush, minor, -)
|
||||||
|
|
||||||
va_start(ap, cmd);
|
va_start(ap, cmd);
|
||||||
args = va_arg(ap, void *);
|
args = va_arg(ap, void *);
|
||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
/*
|
/*
|
||||||
* add ioctls defined for this level here:
|
* add ioctls defined for this level here:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case RTEMS_LIBI2C_IOCTL_GET_DRV_T:
|
case RTEMS_LIBI2C_IOCTL_GET_DRV_T:
|
||||||
/*
|
/*
|
||||||
* query driver table entry
|
* query driver table entry
|
||||||
@@ -611,18 +611,18 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
|||||||
* set tfr mode
|
* set tfr mode
|
||||||
*/
|
*/
|
||||||
if (sc == 0) {
|
if (sc == 0) {
|
||||||
sc = bush->ops->ioctl
|
sc = bush->ops->ioctl
|
||||||
(bush,
|
(bush,
|
||||||
RTEMS_LIBI2C_IOCTL_SET_TFRMODE,
|
RTEMS_LIBI2C_IOCTL_SET_TFRMODE,
|
||||||
&((rtems_libi2c_tfm_read_write_t *)args)->tfr_mode);
|
&((rtems_libi2c_tfm_read_write_t *)args)->tfr_mode);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* perform read_write
|
* perform read_write
|
||||||
*/
|
*/
|
||||||
if (sc == 0) {
|
if (sc == 0) {
|
||||||
sc = bush->ops->ioctl
|
sc = bush->ops->ioctl
|
||||||
(bush,
|
(bush,
|
||||||
RTEMS_LIBI2C_IOCTL_READ_WRITE,
|
RTEMS_LIBI2C_IOCTL_READ_WRITE,
|
||||||
&((rtems_libi2c_tfm_read_write_t *)args)->rd_wr);
|
&((rtems_libi2c_tfm_read_write_t *)args)->rd_wr);
|
||||||
}
|
}
|
||||||
if ((sc < 0) && (is_started)) {
|
if ((sc < 0) && (is_started)) {
|
||||||
@@ -637,9 +637,9 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_s_rw (rtems_device_minor_number minor,
|
do_s_rw (rtems_device_minor_number minor,
|
||||||
unsigned char *bytes,
|
unsigned char *bytes,
|
||||||
int nbytes,
|
int nbytes,
|
||||||
int rw)
|
int rw)
|
||||||
{
|
{
|
||||||
rtems_status_code sc;
|
rtems_status_code sc;
|
||||||
@@ -669,7 +669,7 @@ do_s_rw (rtems_device_minor_number minor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
|
rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
|
||||||
unsigned char *bytes,
|
unsigned char *bytes,
|
||||||
int nbytes)
|
int nbytes)
|
||||||
{
|
{
|
||||||
@@ -677,7 +677,7 @@ rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
rtems_libi2c_start_write_bytes (rtems_device_minor_number minor,
|
rtems_libi2c_start_write_bytes (rtems_device_minor_number minor,
|
||||||
const unsigned char *bytes,
|
const unsigned char *bytes,
|
||||||
int nbytes)
|
int nbytes)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,19 +10,19 @@
|
|||||||
#define _RTEMS_LIBI2C_H
|
#define _RTEMS_LIBI2C_H
|
||||||
/*$Id$*/
|
/*$Id$*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Authorship
|
* Authorship
|
||||||
* ----------
|
* ----------
|
||||||
* This software was created by
|
* This software was created by
|
||||||
* Till Straumann <strauman@slac.stanford.edu>, 2005,
|
* Till Straumann <strauman@slac.stanford.edu>, 2005,
|
||||||
* Stanford Linear Accelerator Center, Stanford University.
|
* Stanford Linear Accelerator Center, Stanford University.
|
||||||
*
|
*
|
||||||
* Acknowledgement of sponsorship
|
* Acknowledgement of sponsorship
|
||||||
* ------------------------------
|
* ------------------------------
|
||||||
* This software was produced by
|
* This software was produced by
|
||||||
* the Stanford Linear Accelerator Center, Stanford University,
|
* the Stanford Linear Accelerator Center, Stanford University,
|
||||||
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
|
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
|
||||||
*
|
*
|
||||||
* Government disclaimer of liability
|
* Government disclaimer of liability
|
||||||
* ----------------------------------
|
* ----------------------------------
|
||||||
* Neither the United States nor the United States Department of Energy,
|
* Neither the United States nor the United States Department of Energy,
|
||||||
@@ -31,18 +31,18 @@
|
|||||||
* completeness, or usefulness of any data, apparatus, product, or process
|
* completeness, or usefulness of any data, apparatus, product, or process
|
||||||
* disclosed, or represents that its use would not infringe privately owned
|
* disclosed, or represents that its use would not infringe privately owned
|
||||||
* rights.
|
* rights.
|
||||||
*
|
*
|
||||||
* Stanford disclaimer of liability
|
* Stanford disclaimer of liability
|
||||||
* --------------------------------
|
* --------------------------------
|
||||||
* Stanford University makes no representations or warranties, express or
|
* Stanford University makes no representations or warranties, express or
|
||||||
* implied, nor assumes any liability for the use of this software.
|
* implied, nor assumes any liability for the use of this software.
|
||||||
*
|
*
|
||||||
* Stanford disclaimer of copyright
|
* Stanford disclaimer of copyright
|
||||||
* --------------------------------
|
* --------------------------------
|
||||||
* Stanford University, owner of the copyright, hereby disclaims its
|
* Stanford University, owner of the copyright, hereby disclaims its
|
||||||
* copyright and all other rights in this software. Hence, anyone may
|
* copyright and all other rights in this software. Hence, anyone may
|
||||||
* freely use it for any purpose without restriction.
|
* freely use it for any purpose without restriction.
|
||||||
*
|
*
|
||||||
* Maintenance of notices
|
* Maintenance of notices
|
||||||
* ----------------------
|
* ----------------------
|
||||||
* In the interest of clarity regarding the origin and status of this
|
* In the interest of clarity regarding the origin and status of this
|
||||||
@@ -51,9 +51,9 @@
|
|||||||
* or distributed by the recipient and are to be affixed to any copy of
|
* or distributed by the recipient and are to be affixed to any copy of
|
||||||
* software made or distributed by the recipient that contains a copy or
|
* software made or distributed by the recipient that contains a copy or
|
||||||
* derivative of this software.
|
* derivative of this software.
|
||||||
*
|
*
|
||||||
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
|
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ rtems_i2c_ioctl (
|
|||||||
|
|
||||||
extern const rtems_driver_address_table rtems_libi2c_io_ops;
|
extern const rtems_driver_address_table rtems_libi2c_io_ops;
|
||||||
|
|
||||||
/* Unfortunately, if you want to add this driver to
|
/* Unfortunately, if you want to add this driver to
|
||||||
* a RTEMS configuration table then you need all the
|
* a RTEMS configuration table then you need all the
|
||||||
* members explicitly :-( (Device_driver_table should
|
* members explicitly :-( (Device_driver_table should
|
||||||
* hold pointers to rtems_driver_address_tables rather
|
* hold pointers to rtems_driver_address_tables rather
|
||||||
@@ -131,7 +131,7 @@ extern const rtems_driver_address_table rtems_libi2c_io_ops;
|
|||||||
*
|
*
|
||||||
* Currently the preferred way is having the BSP
|
* Currently the preferred way is having the BSP
|
||||||
* call 'rtems_libi2c_initialize' followed by
|
* call 'rtems_libi2c_initialize' followed by
|
||||||
* 'rtems_libi2c_register_bus' and
|
* 'rtems_libi2c_register_bus' and
|
||||||
* 'rtems_libi2c_register_drv' and/or
|
* 'rtems_libi2c_register_drv' and/or
|
||||||
* 'mknod' (for 'raw' device nodes)
|
* 'mknod' (for 'raw' device nodes)
|
||||||
* from the 'pretasking_hook'.
|
* from the 'pretasking_hook'.
|
||||||
@@ -165,7 +165,7 @@ typedef struct rtems_libi2c_bus_t_
|
|||||||
} rtems_libi2c_bus_t;
|
} rtems_libi2c_bus_t;
|
||||||
|
|
||||||
/* Access functions a low level driver must provide;
|
/* Access functions a low level driver must provide;
|
||||||
*
|
*
|
||||||
* All of these, except read_bytes and write_bytes
|
* All of these, except read_bytes and write_bytes
|
||||||
* return RTEMS_SUCCESSFUL on success and an error status
|
* return RTEMS_SUCCESSFUL on success and an error status
|
||||||
* otherwise. The read and write ops return the number
|
* otherwise. The read and write ops return the number
|
||||||
@@ -189,7 +189,7 @@ typedef struct rtems_libi2c_bus_ops_
|
|||||||
int (*write_bytes) (rtems_libi2c_bus_t * bushdl, unsigned char *bytes,
|
int (*write_bytes) (rtems_libi2c_bus_t * bushdl, unsigned char *bytes,
|
||||||
int nbytes);
|
int nbytes);
|
||||||
/* ioctl misc functions */
|
/* ioctl misc functions */
|
||||||
int (*ioctl) (rtems_libi2c_bus_t * bushdl,
|
int (*ioctl) (rtems_libi2c_bus_t * bushdl,
|
||||||
int cmd,
|
int cmd,
|
||||||
void *buffer
|
void *buffer
|
||||||
);
|
);
|
||||||
@@ -205,7 +205,7 @@ typedef struct rtems_libi2c_bus_ops_
|
|||||||
* (i.e., libi2c) and the minor number encodes a bus# and a i2c address.
|
* (i.e., libi2c) and the minor number encodes a bus# and a i2c address.
|
||||||
*
|
*
|
||||||
* The name will be registered in the filesystem (parent
|
* The name will be registered in the filesystem (parent
|
||||||
* directories must exist, also IMFS filesystem must exist see
|
* directories must exist, also IMFS filesystem must exist see
|
||||||
* CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM). It may be NULL in which case
|
* CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM). It may be NULL in which case
|
||||||
* the library will pick a default.
|
* the library will pick a default.
|
||||||
*
|
*
|
||||||
@@ -264,10 +264,10 @@ extern rtems_device_major_number rtems_libi2c_major;
|
|||||||
* operations (the aforementioned EEPROM interprets any 3rd
|
* operations (the aforementioned EEPROM interprets any 3rd
|
||||||
* and following byte written to the device as data, i.e., the
|
* and following byte written to the device as data, i.e., the
|
||||||
* contents could easily be changed!).
|
* contents could easily be changed!).
|
||||||
* The correct 'read-pointer offset' programming could be
|
* The correct 'read-pointer offset' programming could be
|
||||||
* implemented in 'open' and 'ioctl' of a high-level driver and
|
* implemented in 'open' and 'ioctl' of a high-level driver and
|
||||||
* the user would then only have to perform harmless read
|
* the user would then only have to perform harmless read
|
||||||
* operations, e.g.,
|
* operations, e.g.,
|
||||||
*
|
*
|
||||||
* fd = open("/dev/i2c.eeprom",O_RDONLY) / * opens and sets EEPROM read pointer * /
|
* fd = open("/dev/i2c.eeprom",O_RDONLY) / * opens and sets EEPROM read pointer * /
|
||||||
* ioctl(fd, IOCTL_SEEK, 0x200) / * repositions the read pointer * /
|
* ioctl(fd, IOCTL_SEEK, 0x200) / * repositions the read pointer * /
|
||||||
@@ -278,14 +278,14 @@ extern rtems_device_major_number rtems_libi2c_major;
|
|||||||
|
|
||||||
/* struct provided at driver registration. The driver may store
|
/* struct provided at driver registration. The driver may store
|
||||||
* private data behind the mandatory first fields but the size
|
* private data behind the mandatory first fields but the size
|
||||||
* must be set to the size of the entire struct, e.g.,
|
* must be set to the size of the entire struct, e.g.,
|
||||||
*
|
*
|
||||||
* struct driver_pvt {
|
* struct driver_pvt {
|
||||||
* rtems_libi2c_drv_t pub;
|
* rtems_libi2c_drv_t pub;
|
||||||
* struct { ... } pvt;
|
* struct { ... } pvt;
|
||||||
* } my_driver = {
|
* } my_driver = {
|
||||||
* { ops: my_ops,
|
* { ops: my_ops,
|
||||||
* size: sizeof(my_driver)
|
* size: sizeof(my_driver)
|
||||||
* },
|
* },
|
||||||
* { ...};
|
* { ...};
|
||||||
* };
|
* };
|
||||||
@@ -305,7 +305,7 @@ typedef struct rtems_libi2c_drv_t_
|
|||||||
*
|
*
|
||||||
* The registration procedure also creates a filesystem node,
|
* The registration procedure also creates a filesystem node,
|
||||||
* i.e., the returned minor number is not really needed.
|
* i.e., the returned minor number is not really needed.
|
||||||
*
|
*
|
||||||
* If the 'name' argument is NULL, no filesystem node is
|
* If the 'name' argument is NULL, no filesystem node is
|
||||||
* created (but this can be done 'manually' using rtems_libi2c_major
|
* created (but this can be done 'manually' using rtems_libi2c_major
|
||||||
* and the return value of this routine).
|
* and the return value of this routine).
|
||||||
@@ -357,13 +357,13 @@ rtems_libi2c_write_bytes (rtems_device_minor_number minor,
|
|||||||
|
|
||||||
/* Send start, send address and read bytes */
|
/* Send start, send address and read bytes */
|
||||||
extern int
|
extern int
|
||||||
rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
|
rtems_libi2c_start_read_bytes (rtems_device_minor_number minor,
|
||||||
unsigned char *bytes,
|
unsigned char *bytes,
|
||||||
int nbytes);
|
int nbytes);
|
||||||
|
|
||||||
/* Send start, send address and write bytes */
|
/* Send start, send address and write bytes */
|
||||||
extern int
|
extern int
|
||||||
rtems_libi2c_start_write_bytes (rtems_device_minor_number minor,
|
rtems_libi2c_start_write_bytes (rtems_device_minor_number minor,
|
||||||
const unsigned char *bytes,
|
const unsigned char *bytes,
|
||||||
int nbytes);
|
int nbytes);
|
||||||
|
|
||||||
@@ -385,12 +385,12 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
|||||||
* retval = rtems_libi2c_ioctl(rtems_device_minor_number minor,
|
* retval = rtems_libi2c_ioctl(rtems_device_minor_number minor,
|
||||||
* RTEMS_LIBI2C_IOCTL_READ_WRITE,
|
* RTEMS_LIBI2C_IOCTL_READ_WRITE,
|
||||||
* rtems_libi2c_read_write_t *arg);
|
* rtems_libi2c_read_write_t *arg);
|
||||||
*
|
*
|
||||||
* This call performs a simultanous read/write transfer,
|
* This call performs a simultanous read/write transfer,
|
||||||
* which is possible (and sometimes needed) for SPI devices
|
* which is possible (and sometimes needed) for SPI devices
|
||||||
*
|
*
|
||||||
* arg is a pointer to a rd_wr info data structure
|
* arg is a pointer to a rd_wr info data structure
|
||||||
*
|
*
|
||||||
* This call is only needed for SPI devices
|
* This call is only needed for SPI devices
|
||||||
*/
|
*/
|
||||||
#define RTEMS_LIBI2C_IOCTL_START_TFM_READ_WRITE 2
|
#define RTEMS_LIBI2C_IOCTL_START_TFM_READ_WRITE 2
|
||||||
@@ -401,17 +401,17 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
|||||||
* const unsigned char *wr_buffer,
|
* const unsigned char *wr_buffer,
|
||||||
* int byte_cnt,
|
* int byte_cnt,
|
||||||
* const rtems_libi2c_tfr_mode_t *tfr_mode_ptr);
|
* const rtems_libi2c_tfr_mode_t *tfr_mode_ptr);
|
||||||
*
|
*
|
||||||
* This call addresses a slave and then:
|
* This call addresses a slave and then:
|
||||||
* - sets the proper transfer mode,
|
* - sets the proper transfer mode,
|
||||||
* - performs a simultanous read/write transfer,
|
* - performs a simultanous read/write transfer,
|
||||||
* (which is possible and sometimes needed for SPI devices)
|
* (which is possible and sometimes needed for SPI devices)
|
||||||
* NOTE: - if rd_buffer is NULL, receive data will be dropped
|
* NOTE: - if rd_buffer is NULL, receive data will be dropped
|
||||||
* - if wr_buffer is NULL, bytes with content 0 will transmitted
|
* - if wr_buffer is NULL, bytes with content 0 will transmitted
|
||||||
*
|
*
|
||||||
* rd_buffer is a pointer to a receive buffer (or NULL)
|
* rd_buffer is a pointer to a receive buffer (or NULL)
|
||||||
* wr_buffer is a pointer to the data to be sent (or NULL)
|
* wr_buffer is a pointer to the data to be sent (or NULL)
|
||||||
*
|
*
|
||||||
* This call is only needed for SPI devices
|
* This call is only needed for SPI devices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -420,12 +420,12 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
|||||||
* retval = rtems_libi2c_ioctl(rtems_device_minor_number minor,
|
* retval = rtems_libi2c_ioctl(rtems_device_minor_number minor,
|
||||||
* RTEMS_LIBI2C_IOCTL_SET_TFRMODE,
|
* RTEMS_LIBI2C_IOCTL_SET_TFRMODE,
|
||||||
* const rtems_libi2c_tfr_mode_t *tfr_mode_ptr);
|
* const rtems_libi2c_tfr_mode_t *tfr_mode_ptr);
|
||||||
*
|
*
|
||||||
* This call sets an SPI device to the transfer mode needed (baudrate etc.)
|
* This call sets an SPI device to the transfer mode needed (baudrate etc.)
|
||||||
*
|
*
|
||||||
* tfr_mode is a pointer to a structure defining the SPI transfer mode needed
|
* tfr_mode is a pointer to a structure defining the SPI transfer mode needed
|
||||||
* (see below).
|
* (see below).
|
||||||
*
|
*
|
||||||
* This call is only needed for SPI devices
|
* This call is only needed for SPI devices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -435,10 +435,10 @@ rtems_libi2c_ioctl (rtems_device_minor_number minor,
|
|||||||
* retval = rtems_libi2c_ioctl(rtems_device_minor_number minor,
|
* retval = rtems_libi2c_ioctl(rtems_device_minor_number minor,
|
||||||
* RTEMS_LIBI2C_IOCTL_GET_DRV_T,
|
* RTEMS_LIBI2C_IOCTL_GET_DRV_T,
|
||||||
* const rtems_libi2c_drv_t *drv_t_ptr);
|
* const rtems_libi2c_drv_t *drv_t_ptr);
|
||||||
*
|
*
|
||||||
* This call allows the a high-level driver to query its driver table entry,
|
* This call allows the a high-level driver to query its driver table entry,
|
||||||
* including its private data appended to it during creation of the entry
|
* including its private data appended to it during creation of the entry
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -42,16 +42,16 @@ const char *rtems_bsp_cmdline_get_param(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
if ( !name )
|
if ( !name )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ( !value )
|
if ( !value )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ( !length )
|
if ( !length )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
value[0] = '\0';
|
value[0] = '\0';
|
||||||
|
|
||||||
p = rtems_bsp_cmdline_get_param_raw( name );
|
p = rtems_bsp_cmdline_get_param_raw( name );
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const char *rtems_bsp_cmdline_get_param_raw(
|
|||||||
|
|
||||||
if ( !name )
|
if ( !name )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if ( !bsp_boot_cmdline )
|
if ( !bsp_boot_cmdline )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ const char *rtems_bsp_cmdline_get_param_rhs(
|
|||||||
if ( *(d-1) == '\"' )
|
if ( *(d-1) == '\"' )
|
||||||
d--;
|
d--;
|
||||||
*d = '\0';
|
*d = '\0';
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg __attribute__((unuse
|
|||||||
rtems_task_priority ceiling = rtems_capture_watch_get_ceiling ();
|
rtems_task_priority ceiling = rtems_capture_watch_get_ceiling ();
|
||||||
rtems_task_priority floor = rtems_capture_watch_get_floor ();
|
rtems_task_priority floor = rtems_capture_watch_get_floor ();
|
||||||
int last_count = 0;
|
int last_count = 0;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
rtems_capture_task_t* tasks[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
|
rtems_capture_task_t* tasks[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
|
||||||
@@ -431,14 +431,14 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg __attribute__((unuse
|
|||||||
|
|
||||||
if (count < RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS)
|
if (count < RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS)
|
||||||
{
|
{
|
||||||
j = RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS - count;
|
j = RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS - count;
|
||||||
while (j > 0)
|
while (j > 0)
|
||||||
{
|
{
|
||||||
fprintf (stdout, "\x1b[K\n");
|
fprintf (stdout, "\x1b[K\n");
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
last_count = count;
|
last_count = count;
|
||||||
|
|
||||||
cli_load_thread_active = 0;
|
cli_load_thread_active = 0;
|
||||||
@@ -477,13 +477,13 @@ rtems_capture_cli_task_load (int argc __attribute__((un
|
|||||||
}
|
}
|
||||||
|
|
||||||
name = rtems_build_name('C', 'P', 'l', 't');
|
name = rtems_build_name('C', 'P', 'l', 't');
|
||||||
|
|
||||||
sc = rtems_task_create (name, priority, 4 * 1024,
|
sc = rtems_task_create (name, priority, 4 * 1024,
|
||||||
RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
|
RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
|
||||||
RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
|
RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
|
||||||
&id);
|
&id);
|
||||||
|
|
||||||
if (sc != RTEMS_SUCCESSFUL)
|
if (sc != RTEMS_SUCCESSFUL)
|
||||||
{
|
{
|
||||||
fprintf (stdout, "error: cannot create helper thread: %s\n",
|
fprintf (stdout, "error: cannot create helper thread: %s\n",
|
||||||
rtems_status_text (sc));
|
rtems_status_text (sc));
|
||||||
@@ -660,7 +660,7 @@ rtems_capture_cli_get_name_id (char* arg,
|
|||||||
* remove unless the score has been updated.
|
* remove unless the score has been updated.
|
||||||
*/
|
*/
|
||||||
rtems_name rname;
|
rtems_name rname;
|
||||||
|
|
||||||
rname = rtems_build_name(arg[0], arg[1], arg[2], arg[3]);
|
rname = rtems_build_name(arg[0], arg[1], arg[2], arg[3]);
|
||||||
*name = rname;
|
*name = rname;
|
||||||
*valid_name = true;
|
*valid_name = true;
|
||||||
@@ -1118,7 +1118,7 @@ rtems_capture_cli_trigger_worker (int set, int argc, char** argv)
|
|||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
int t;
|
int t;
|
||||||
|
|
||||||
for (t = 0; t < RTEMS_CAPTURE_CLI_TRIGGERS_NUM; t++)
|
for (t = 0; t < RTEMS_CAPTURE_CLI_TRIGGERS_NUM; t++)
|
||||||
if (strcmp (argv[arg], rtems_capture_cli_triggers[t].name) == 0)
|
if (strcmp (argv[arg], rtems_capture_cli_triggers[t].name) == 0)
|
||||||
{
|
{
|
||||||
@@ -1141,7 +1141,7 @@ rtems_capture_cli_trigger_worker (int set, int argc, char** argv)
|
|||||||
{
|
{
|
||||||
if (is_from)
|
if (is_from)
|
||||||
fprintf (stdout, "warning: extra 'from' ignored\n");
|
fprintf (stdout, "warning: extra 'from' ignored\n");
|
||||||
|
|
||||||
is_from = 1;
|
is_from = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1170,7 +1170,7 @@ rtems_capture_cli_trigger_worker (int set, int argc, char** argv)
|
|||||||
else
|
else
|
||||||
fprintf (stdout, "warning: extra arguments ignored\n");
|
fprintf (stdout, "warning: extra arguments ignored\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valid_id)
|
if (valid_id)
|
||||||
{
|
{
|
||||||
if (is_from)
|
if (is_from)
|
||||||
@@ -1200,7 +1200,7 @@ rtems_capture_cli_trigger_worker (int set, int argc, char** argv)
|
|||||||
rtems_capture_cli_triggers[trigger].name);
|
rtems_capture_cli_triggers[trigger].name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!to_valid_name && !to_valid_id && !from_valid_name && !from_valid_id)
|
if (!to_valid_name && !to_valid_id && !from_valid_name && !from_valid_id)
|
||||||
{
|
{
|
||||||
fprintf (stdout, trigger_set_usage);
|
fprintf (stdout, trigger_set_usage);
|
||||||
@@ -1351,7 +1351,7 @@ rtems_capture_cli_trace_records (int argc,
|
|||||||
* If we have no records then just exist. We still need to release
|
* If we have no records then just exist. We still need to release
|
||||||
* the reader lock.
|
* the reader lock.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (read == 0)
|
if (read == 0)
|
||||||
{
|
{
|
||||||
rtems_capture_release (read);
|
rtems_capture_release (read);
|
||||||
@@ -1359,7 +1359,7 @@ rtems_capture_cli_trace_records (int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
count = total < read ? total : read;
|
count = total < read ? total : read;
|
||||||
|
|
||||||
while (count--)
|
while (count--)
|
||||||
{
|
{
|
||||||
if (csv)
|
if (csv)
|
||||||
@@ -1403,7 +1403,7 @@ rtems_capture_cli_trace_records (int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
count = total < read ? total : read;
|
count = total < read ? total : read;
|
||||||
|
|
||||||
if (count < total)
|
if (count < total)
|
||||||
total -= count;
|
total -= count;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
* watch filters.
|
* watch filters.
|
||||||
*
|
*
|
||||||
* This feature has been disabled as it becomes confusing when
|
* This feature has been disabled as it becomes confusing when
|
||||||
* setting up filters and some event leak.
|
* setting up filters and some event leak.
|
||||||
*/
|
*/
|
||||||
#if defined (RTEMS_CAPTURE_ENGINE_ALLOW_RELATED_EVENTS)
|
#if defined (RTEMS_CAPTURE_ENGINE_ALLOW_RELATED_EVENTS)
|
||||||
#define RTEMS_CAPTURE_RECORD_EVENTS (RTEMS_CAPTURE_CREATED_BY_EVENT | \
|
#define RTEMS_CAPTURE_RECORD_EVENTS (RTEMS_CAPTURE_CREATED_BY_EVENT | \
|
||||||
@@ -220,7 +220,7 @@ rtems_capture_by_in_to (uint32_t events,
|
|||||||
uint32_t valid_mask = RTEMS_CAPTURE_CONTROL_FROM_MASK (0);
|
uint32_t valid_mask = RTEMS_CAPTURE_CONTROL_FROM_MASK (0);
|
||||||
uint32_t valid_remainder = 0xffffffff;
|
uint32_t valid_remainder = 0xffffffff;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < RTEMS_CAPTURE_TRIGGER_TASKS; i++)
|
for (i = 0; i < RTEMS_CAPTURE_TRIGGER_TASKS; i++)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -245,11 +245,11 @@ rtems_capture_by_in_to (uint32_t events,
|
|||||||
by->name, by->id))
|
by->name, by->id))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
valid_mask >>= 1;
|
valid_mask >>= 1;
|
||||||
valid_remainder >>= 1;
|
valid_remainder >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ rtems_capture_create_capture_task (rtems_tcb* new_task)
|
|||||||
rtems_capture_task_t* task;
|
rtems_capture_task_t* task;
|
||||||
rtems_capture_control_t* control;
|
rtems_capture_control_t* control;
|
||||||
rtems_name name;
|
rtems_name name;
|
||||||
|
|
||||||
task = _Workspace_Allocate (sizeof (rtems_capture_task_t));
|
task = _Workspace_Allocate (sizeof (rtems_capture_task_t));
|
||||||
|
|
||||||
if (task == NULL)
|
if (task == NULL)
|
||||||
@@ -414,9 +414,9 @@ rtems_capture_create_capture_task (rtems_tcb* new_task)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
rtems_object_get_classic_name( new_task->Object.id, &name );
|
rtems_object_get_classic_name( new_task->Object.id, &name );
|
||||||
|
|
||||||
rtems_capture_dup_name (&task->name, name);
|
rtems_capture_dup_name (&task->name, name);
|
||||||
|
|
||||||
task->id = new_task->Object.id;
|
task->id = new_task->Object.id;
|
||||||
task->flags = 0;
|
task->flags = 0;
|
||||||
task->in = 0;
|
task->in = 0;
|
||||||
@@ -590,14 +590,14 @@ rtems_capture_trigger (rtems_capture_task_t* ft,
|
|||||||
uint32_t from_events = 0;
|
uint32_t from_events = 0;
|
||||||
uint32_t to_events = 0;
|
uint32_t to_events = 0;
|
||||||
uint32_t from_to_events = 0;
|
uint32_t from_to_events = 0;
|
||||||
|
|
||||||
if (ft)
|
if (ft)
|
||||||
{
|
{
|
||||||
fc = ft->control;
|
fc = ft->control;
|
||||||
if (fc)
|
if (fc)
|
||||||
from_events = fc->from_triggers & events;
|
from_events = fc->from_triggers & events;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tt)
|
if (tt)
|
||||||
{
|
{
|
||||||
tc = tt->control;
|
tc = tt->control;
|
||||||
@@ -636,7 +636,7 @@ rtems_capture_trigger (rtems_capture_task_t* ft,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,7 +711,7 @@ rtems_capture_start_task (rtems_tcb* current_task,
|
|||||||
|
|
||||||
if (st == NULL)
|
if (st == NULL)
|
||||||
st = rtems_capture_create_capture_task (started_task);
|
st = rtems_capture_create_capture_task (started_task);
|
||||||
|
|
||||||
if (rtems_capture_trigger (ct, st, RTEMS_CAPTURE_START))
|
if (rtems_capture_trigger (ct, st, RTEMS_CAPTURE_START))
|
||||||
{
|
{
|
||||||
rtems_capture_record (ct, RTEMS_CAPTURE_STARTED_BY_EVENT);
|
rtems_capture_record (ct, RTEMS_CAPTURE_STARTED_BY_EVENT);
|
||||||
@@ -802,7 +802,7 @@ rtems_capture_delete_task (rtems_tcb* current_task,
|
|||||||
rtems_capture_record (ct, RTEMS_CAPTURE_DELETED_BY_EVENT);
|
rtems_capture_record (ct, RTEMS_CAPTURE_DELETED_BY_EVENT);
|
||||||
rtems_capture_record (dt, RTEMS_CAPTURE_DELETED_EVENT);
|
rtems_capture_record (dt, RTEMS_CAPTURE_DELETED_EVENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtems_capture_task_stack_usage (dt);
|
rtems_capture_task_stack_usage (dt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1223,7 +1223,7 @@ rtems_capture_flush (bool prime)
|
|||||||
capture_count = 0;
|
capture_count = 0;
|
||||||
capture_in = capture_records;
|
capture_in = capture_records;
|
||||||
capture_out = 0;
|
capture_out = 0;
|
||||||
|
|
||||||
rtems_interrupt_enable (level);
|
rtems_interrupt_enable (level);
|
||||||
|
|
||||||
task = capture_tasks;
|
task = capture_tasks;
|
||||||
@@ -1540,7 +1540,7 @@ rtems_capture_set_trigger (rtems_name from_name,
|
|||||||
* FROM ANY means trigger when the event happens TO this
|
* FROM ANY means trigger when the event happens TO this
|
||||||
* task. TO ANY means FROM this task.
|
* task. TO ANY means FROM this task.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (mode == rtems_capture_to_any)
|
if (mode == rtems_capture_to_any)
|
||||||
{
|
{
|
||||||
control = rtems_capture_create_control (from_name, from_id);
|
control = rtems_capture_create_control (from_name, from_id);
|
||||||
@@ -1559,9 +1559,9 @@ rtems_capture_set_trigger (rtems_name from_name,
|
|||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
control->by_triggers |= flags;
|
control->by_triggers |= flags;
|
||||||
|
|
||||||
for (i = 0; i < RTEMS_CAPTURE_TRIGGER_TASKS; i++)
|
for (i = 0; i < RTEMS_CAPTURE_TRIGGER_TASKS; i++)
|
||||||
{
|
{
|
||||||
if (rtems_capture_control_by_valid (control, i) &&
|
if (rtems_capture_control_by_valid (control, i) &&
|
||||||
@@ -1616,7 +1616,7 @@ rtems_capture_clear_trigger (rtems_name from_name,
|
|||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
|
||||||
flags = rtems_capture_map_trigger (trigger);
|
flags = rtems_capture_map_trigger (trigger);
|
||||||
|
|
||||||
if (mode == rtems_capture_to_any)
|
if (mode == rtems_capture_to_any)
|
||||||
{
|
{
|
||||||
control = rtems_capture_find_control (from_name, from_id);
|
control = rtems_capture_find_control (from_name, from_id);
|
||||||
@@ -1643,9 +1643,9 @@ rtems_capture_clear_trigger (rtems_name from_name,
|
|||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
control->by_triggers &= ~flags;
|
control->by_triggers &= ~flags;
|
||||||
|
|
||||||
for (i = 0; i < RTEMS_CAPTURE_TRIGGER_TASKS; i++)
|
for (i = 0; i < RTEMS_CAPTURE_TRIGGER_TASKS; i++)
|
||||||
{
|
{
|
||||||
if (rtems_capture_control_by_valid (control, i) &&
|
if (rtems_capture_control_by_valid (control, i) &&
|
||||||
@@ -1808,7 +1808,7 @@ rtems_capture_release (uint32_t count)
|
|||||||
{
|
{
|
||||||
rtems_capture_record_t* rec;
|
rtems_capture_record_t* rec;
|
||||||
uint32_t counted;
|
uint32_t counted;
|
||||||
|
|
||||||
rtems_interrupt_level level;
|
rtems_interrupt_level level;
|
||||||
|
|
||||||
rtems_interrupt_disable (level);
|
rtems_interrupt_disable (level);
|
||||||
@@ -1819,7 +1819,7 @@ rtems_capture_release (uint32_t count)
|
|||||||
rtems_interrupt_enable (level);
|
rtems_interrupt_enable (level);
|
||||||
|
|
||||||
counted = count;
|
counted = count;
|
||||||
|
|
||||||
rec = &capture_records[capture_out];
|
rec = &capture_records[capture_out];
|
||||||
|
|
||||||
while (counted--)
|
while (counted--)
|
||||||
@@ -1828,7 +1828,7 @@ rtems_capture_release (uint32_t count)
|
|||||||
rtems_capture_destroy_capture_task (rec->task);
|
rtems_capture_destroy_capture_task (rec->task);
|
||||||
rec++;
|
rec++;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtems_interrupt_disable (level);
|
rtems_interrupt_disable (level);
|
||||||
|
|
||||||
capture_count -= count;
|
capture_count -= count;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void rtems_cpu_usage_report_with_plugin(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(*print)(
|
(*print)(
|
||||||
context,
|
context,
|
||||||
"-------------------------------------------------------------------------------\n"
|
"-------------------------------------------------------------------------------\n"
|
||||||
@@ -113,7 +113,7 @@ void rtems_cpu_usage_report_with_plugin(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
rtems_object_get_name( the_thread->Object.id, sizeof(name), name );
|
rtems_object_get_name( the_thread->Object.id, sizeof(name), name );
|
||||||
|
|
||||||
(*print)(
|
(*print)(
|
||||||
context,
|
context,
|
||||||
" 0x%08" PRIx32 " | %-38s |",
|
" 0x%08" PRIx32 " | %-38s |",
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ rtems_monitor_line_editor (
|
|||||||
|
|
||||||
extended_key = rtems_monitor_getchar ();
|
extended_key = rtems_monitor_getchar ();
|
||||||
c = extended_key & KEYS_NORMAL_MASK;
|
c = extended_key & KEYS_NORMAL_MASK;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make the extended_key usable as a boolean.
|
* Make the extended_key usable as a boolean.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ rtems_monitor_init_task_dump(
|
|||||||
length += rtems_monitor_symbol_dump(&monitor_itask->entry, verbose);
|
length += rtems_monitor_symbol_dump(&monitor_itask->entry, verbose);
|
||||||
|
|
||||||
length += rtems_monitor_pad(25, length);
|
length += rtems_monitor_pad(25, length);
|
||||||
length += fprintf(stdout,"%" PRId32 " [0x%" PRIx32 "]",
|
length += fprintf(stdout,"%" PRId32 " [0x%" PRIx32 "]",
|
||||||
monitor_itask->argument, monitor_itask->argument);
|
monitor_itask->argument, monitor_itask->argument);
|
||||||
|
|
||||||
length += rtems_monitor_pad(39, length);
|
length += rtems_monitor_pad(39, length);
|
||||||
|
|||||||
@@ -50,19 +50,19 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
memset(&dstaddr, 0, sizeof(dstaddr));
|
memset(&dstaddr, 0, sizeof(dstaddr));
|
||||||
memset(&netmask, 0, sizeof(netmask));
|
memset(&netmask, 0, sizeof(netmask));
|
||||||
memset(&broadcast, 0, sizeof(broadcast));
|
memset(&broadcast, 0, sizeof(broadcast));
|
||||||
|
|
||||||
ipaddr.sin_len = sizeof(ipaddr);
|
ipaddr.sin_len = sizeof(ipaddr);
|
||||||
ipaddr.sin_family = AF_INET;
|
ipaddr.sin_family = AF_INET;
|
||||||
|
|
||||||
dstaddr.sin_len = sizeof(dstaddr);
|
dstaddr.sin_len = sizeof(dstaddr);
|
||||||
dstaddr.sin_family = AF_INET;
|
dstaddr.sin_family = AF_INET;
|
||||||
|
|
||||||
netmask.sin_len = sizeof(netmask);
|
netmask.sin_len = sizeof(netmask);
|
||||||
netmask.sin_family = AF_INET;
|
netmask.sin_family = AF_INET;
|
||||||
|
|
||||||
broadcast.sin_len = sizeof(broadcast);
|
broadcast.sin_len = sizeof(broadcast);
|
||||||
broadcast.sin_family = AF_INET;
|
broadcast.sin_family = AF_INET;
|
||||||
|
|
||||||
cur_idx = 0;
|
cur_idx = 0;
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
/* display all interfaces */
|
/* display all interfaces */
|
||||||
@@ -81,11 +81,11 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
cur_idx += 2;
|
cur_idx += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((f_down !=0) && (f_ip != 0)) {
|
if ((f_down !=0) && (f_ip != 0)) {
|
||||||
f_up = 1;
|
f_up = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(argc > cur_idx) {
|
while(argc > cur_idx) {
|
||||||
if (strcmp(argv[cur_idx], "up") == 0) {
|
if (strcmp(argv[cur_idx], "up") == 0) {
|
||||||
f_up = 1;
|
f_up = 1;
|
||||||
@@ -101,7 +101,7 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
if ((cur_idx + 1) >= argc) {
|
if ((cur_idx + 1) >= argc) {
|
||||||
printf("No netmask address\n");
|
printf("No netmask address\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (inet_pton(AF_INET, argv[cur_idx+1], &netmask.sin_addr) < 0) {
|
if (inet_pton(AF_INET, argv[cur_idx+1], &netmask.sin_addr) < 0) {
|
||||||
printf("bad netmask: %s\n", argv[cur_idx]);
|
printf("bad netmask: %s\n", argv[cur_idx]);
|
||||||
return;
|
return;
|
||||||
@@ -112,7 +112,7 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
if ((cur_idx + 1) >= argc) {
|
if ((cur_idx + 1) >= argc) {
|
||||||
printf("No broadcast address\n");
|
printf("No broadcast address\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (inet_pton(AF_INET, argv[cur_idx+1], &broadcast.sin_addr) < 0) {
|
if (inet_pton(AF_INET, argv[cur_idx+1], &broadcast.sin_addr) < 0) {
|
||||||
printf("bad broadcast: %s\n", argv[cur_idx]);
|
printf("bad broadcast: %s\n", argv[cur_idx]);
|
||||||
return;
|
return;
|
||||||
@@ -123,22 +123,22 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
if ((cur_idx + 1) >= argc) {
|
if ((cur_idx + 1) >= argc) {
|
||||||
printf("No pointopoint address\n");
|
printf("No pointopoint address\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (inet_pton(AF_INET, argv[cur_idx+1], &dstaddr.sin_addr) < 0) {
|
if (inet_pton(AF_INET, argv[cur_idx+1], &dstaddr.sin_addr) < 0) {
|
||||||
printf("bad pointopoint: %s\n", argv[cur_idx]);
|
printf("bad pointopoint: %s\n", argv[cur_idx]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f_ptp = 1;
|
f_ptp = 1;
|
||||||
cur_idx += 1;
|
cur_idx += 1;
|
||||||
} else {
|
} else {
|
||||||
printf("Bad parameter: %s\n", argv[cur_idx]);
|
printf("Bad parameter: %s\n", argv[cur_idx]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_idx += 1;
|
cur_idx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("ifconfig ");
|
printf("ifconfig ");
|
||||||
if (iface != NULL) {
|
if (iface != NULL) {
|
||||||
printf("%s ", iface);
|
printf("%s ", iface);
|
||||||
@@ -147,25 +147,25 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
inet_ntop(AF_INET, &ipaddr.sin_addr, str, 256);
|
inet_ntop(AF_INET, &ipaddr.sin_addr, str, 256);
|
||||||
printf("%s ", str);
|
printf("%s ", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_netmask != 0) {
|
if (f_netmask != 0) {
|
||||||
char str[256];
|
char str[256];
|
||||||
inet_ntop(AF_INET, &netmask.sin_addr, str, 256);
|
inet_ntop(AF_INET, &netmask.sin_addr, str, 256);
|
||||||
printf("netmask %s ", str);
|
printf("netmask %s ", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_bcast != 0) {
|
if (f_bcast != 0) {
|
||||||
char str[256];
|
char str[256];
|
||||||
inet_ntop(AF_INET, &broadcast.sin_addr, str, 256);
|
inet_ntop(AF_INET, &broadcast.sin_addr, str, 256);
|
||||||
printf("broadcast %s ", str);
|
printf("broadcast %s ", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_ptp != 0) {
|
if (f_ptp != 0) {
|
||||||
char str[256];
|
char str[256];
|
||||||
inet_ntop(AF_INET, &dstaddr.sin_addr, str, 256);
|
inet_ntop(AF_INET, &dstaddr.sin_addr, str, 256);
|
||||||
printf("pointopoint %s ", str);
|
printf("pointopoint %s ", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_up != 0) {
|
if (f_up != 0) {
|
||||||
printf("up\n");
|
printf("up\n");
|
||||||
} else if (f_down != 0) {
|
} else if (f_down != 0) {
|
||||||
@@ -174,12 +174,12 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((iface == NULL) || ((f_ip == 0) && (f_down == 0) && (f_up == 0))) {
|
if ((iface == NULL) || ((f_ip == 0) && (f_down == 0) && (f_up == 0))) {
|
||||||
rtems_bsdnet_show_if_stats();
|
rtems_bsdnet_show_if_stats();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
if (f_netmask) {
|
if (f_netmask) {
|
||||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFNETMASK, &netmask);
|
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFNETMASK, &netmask);
|
||||||
@@ -188,7 +188,7 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_bcast) {
|
if (f_bcast) {
|
||||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFBRDADDR, &broadcast);
|
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFBRDADDR, &broadcast);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@@ -196,7 +196,7 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_ptp) {
|
if (f_ptp) {
|
||||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFDSTADDR, &dstaddr);
|
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFDSTADDR, &dstaddr);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@@ -205,8 +205,8 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
}
|
}
|
||||||
flags |= IFF_POINTOPOINT;
|
flags |= IFF_POINTOPOINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This must come _after_ setting the netmask, broadcast addresses */
|
/* This must come _after_ setting the netmask, broadcast addresses */
|
||||||
if (f_ip) {
|
if (f_ip) {
|
||||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFADDR, &ipaddr);
|
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFADDR, &ipaddr);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@@ -214,15 +214,15 @@ void mon_ifconfig(int argc, char *argv[],
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_up != 0) {
|
if (f_up != 0) {
|
||||||
flags |= IFF_UP;
|
flags |= IFF_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_down != 0) {
|
if (f_down != 0) {
|
||||||
printf("Warning: taking interfaces down is not supported\n");
|
printf("Warning: taking interfaces down is not supported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFFLAGS, &flags);
|
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFFLAGS, &flags);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
printf("Could not set interface flags: %s\n", strerror(errno));
|
printf("Could not set interface flags: %s\n", strerror(errno));
|
||||||
@@ -245,28 +245,28 @@ void mon_route(int argc, char *argv[],
|
|||||||
int cur_idx;
|
int cur_idx;
|
||||||
int flags;
|
int flags;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
memset(&dst, 0, sizeof(dst));
|
memset(&dst, 0, sizeof(dst));
|
||||||
memset(&gw, 0, sizeof(gw));
|
memset(&gw, 0, sizeof(gw));
|
||||||
memset(&netmask, 0, sizeof(netmask));
|
memset(&netmask, 0, sizeof(netmask));
|
||||||
|
|
||||||
dst.sin_len = sizeof(dst);
|
dst.sin_len = sizeof(dst);
|
||||||
dst.sin_family = AF_INET;
|
dst.sin_family = AF_INET;
|
||||||
dst.sin_addr.s_addr = inet_addr("0.0.0.0");
|
dst.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||||
|
|
||||||
gw.sin_len = sizeof(gw);
|
gw.sin_len = sizeof(gw);
|
||||||
gw.sin_family = AF_INET;
|
gw.sin_family = AF_INET;
|
||||||
gw.sin_addr.s_addr = inet_addr("0.0.0.0");
|
gw.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||||
|
|
||||||
netmask.sin_len = sizeof(netmask);
|
netmask.sin_len = sizeof(netmask);
|
||||||
netmask.sin_family = AF_INET;
|
netmask.sin_family = AF_INET;
|
||||||
netmask.sin_addr.s_addr = inet_addr("255.255.255.0");
|
netmask.sin_addr.s_addr = inet_addr("255.255.255.0");
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
rtems_bsdnet_show_inet_routes();
|
rtems_bsdnet_show_inet_routes();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[1], "add") == 0) {
|
if (strcmp(argv[1], "add") == 0) {
|
||||||
cmd = RTM_ADD;
|
cmd = RTM_ADD;
|
||||||
} else if (strcmp(argv[1], "del") == 0) {
|
} else if (strcmp(argv[1], "del") == 0) {
|
||||||
@@ -276,12 +276,12 @@ void mon_route(int argc, char *argv[],
|
|||||||
printf("\tit should be 'add' or 'del'\n");
|
printf("\tit should be 'add' or 'del'\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
printf("not enough arguments\n");
|
printf("not enough arguments\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[2], "-host") == 0) {
|
if (strcmp(argv[2], "-host") == 0) {
|
||||||
f_host = 1;
|
f_host = 1;
|
||||||
} else if (strcmp(argv[2], "-net") == 0) {
|
} else if (strcmp(argv[2], "-net") == 0) {
|
||||||
@@ -291,14 +291,14 @@ void mon_route(int argc, char *argv[],
|
|||||||
printf("\tit should be '-host' or '-net'\n");
|
printf("\tit should be '-host' or '-net'\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
printf("not enough arguments\n");
|
printf("not enough arguments\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inet_pton(AF_INET, argv[3], &dst.sin_addr);
|
inet_pton(AF_INET, argv[3], &dst.sin_addr);
|
||||||
|
|
||||||
cur_idx = 4;
|
cur_idx = 4;
|
||||||
while(cur_idx < argc) {
|
while(cur_idx < argc) {
|
||||||
if (strcmp(argv[cur_idx], "gw") == 0) {
|
if (strcmp(argv[cur_idx], "gw") == 0) {
|
||||||
@@ -323,7 +323,7 @@ void mon_route(int argc, char *argv[],
|
|||||||
}
|
}
|
||||||
cur_idx += 1;
|
cur_idx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = RTF_STATIC;
|
flags = RTF_STATIC;
|
||||||
if (f_gw != 0) {
|
if (f_gw != 0) {
|
||||||
flags |= RTF_GATEWAY;
|
flags |= RTF_GATEWAY;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ rtems_monitor_part_dump_header(
|
|||||||
ID NAME ATTR STARTADDR LENGTH BUF_SIZE USED_BLOCKS\n");
|
ID NAME ATTR STARTADDR LENGTH BUF_SIZE USED_BLOCKS\n");
|
||||||
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
|
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
|
||||||
1 2 3 4 5 6 7 */
|
1 2 3 4 5 6 7 */
|
||||||
|
|
||||||
rtems_monitor_separator();
|
rtems_monitor_separator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ rtems_monitor_dump_name(rtems_id id)
|
|||||||
{
|
{
|
||||||
char name_buffer[18];
|
char name_buffer[18];
|
||||||
|
|
||||||
rtems_object_get_name( id, sizeof(name_buffer), name_buffer );
|
rtems_object_get_name( id, sizeof(name_buffer), name_buffer );
|
||||||
|
|
||||||
return fprintf( stdout, name_buffer );
|
return fprintf( stdout, name_buffer );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ rtems_monitor_region_dump_header(
|
|||||||
ID NAME ATTR STARTADDR LENGTH PAGE_SIZE USED_BLOCKS\n");
|
ID NAME ATTR STARTADDR LENGTH PAGE_SIZE USED_BLOCKS\n");
|
||||||
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
|
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
|
||||||
1 2 3 4 5 6 7 */
|
1 2 3 4 5 6 7 */
|
||||||
|
|
||||||
rtems_monitor_separator();
|
rtems_monitor_separator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,18 +23,18 @@ rtems_monitor_sema_canonical(
|
|||||||
Semaphore_Control *rtems_sema = (Semaphore_Control *) sema_void;
|
Semaphore_Control *rtems_sema = (Semaphore_Control *) sema_void;
|
||||||
|
|
||||||
canonical_sema->attribute = rtems_sema->attribute_set;
|
canonical_sema->attribute = rtems_sema->attribute_set;
|
||||||
canonical_sema->priority_ceiling =
|
canonical_sema->priority_ceiling =
|
||||||
rtems_sema->Core_control.mutex.Attributes.priority_ceiling;
|
rtems_sema->Core_control.mutex.Attributes.priority_ceiling;
|
||||||
|
|
||||||
canonical_sema->holder_id =
|
canonical_sema->holder_id =
|
||||||
rtems_sema->Core_control.mutex.holder_id;
|
rtems_sema->Core_control.mutex.holder_id;
|
||||||
|
|
||||||
if (_Attributes_Is_counting_semaphore(canonical_sema->attribute)) {
|
if (_Attributes_Is_counting_semaphore(canonical_sema->attribute)) {
|
||||||
/* we have a counting semaphore */
|
/* we have a counting semaphore */
|
||||||
canonical_sema->cur_count =
|
canonical_sema->cur_count =
|
||||||
rtems_sema->Core_control.semaphore.count;
|
rtems_sema->Core_control.semaphore.count;
|
||||||
|
|
||||||
canonical_sema->max_count =
|
canonical_sema->max_count =
|
||||||
rtems_sema->Core_control.semaphore.Attributes.maximum_count;
|
rtems_sema->Core_control.semaphore.Attributes.maximum_count;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -54,7 +54,7 @@ rtems_monitor_sema_dump_header(
|
|||||||
ID NAME ATTR PRICEIL CURR_CNT HOLDID \n");
|
ID NAME ATTR PRICEIL CURR_CNT HOLDID \n");
|
||||||
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
|
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
|
||||||
1 2 3 4 5 6 7 */
|
1 2 3 4 5 6 7 */
|
||||||
|
|
||||||
rtems_monitor_separator();
|
rtems_monitor_separator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ rtems_monitor_task_canonical(
|
|||||||
canonical_task->state = rtems_thread->current_state;
|
canonical_task->state = rtems_thread->current_state;
|
||||||
canonical_task->wait_id = rtems_thread->Wait.id;
|
canonical_task->wait_id = rtems_thread->Wait.id;
|
||||||
canonical_task->events = api->pending_events;
|
canonical_task->events = api->pending_events;
|
||||||
/*
|
/*
|
||||||
* FIXME: make this optionally cpu_time_executed
|
* FIXME: make this optionally cpu_time_executed
|
||||||
*/
|
*/
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ static bool rtems_shell_register_command(const rtems_monitor_command_entry_t *e,
|
|||||||
if (strcmp("exit", e->command) != 0) {
|
if (strcmp("exit", e->command) != 0) {
|
||||||
rtems_shell_cmd_t *shell_cmd =
|
rtems_shell_cmd_t *shell_cmd =
|
||||||
(rtems_shell_cmd_t *) malloc(sizeof(rtems_shell_cmd_t));
|
(rtems_shell_cmd_t *) malloc(sizeof(rtems_shell_cmd_t));
|
||||||
|
|
||||||
if (shell_cmd != NULL) {
|
if (shell_cmd != NULL) {
|
||||||
shell_cmd->name = e->command;
|
shell_cmd->name = e->command;
|
||||||
shell_cmd->topic = "monitor";
|
shell_cmd->topic = "monitor";
|
||||||
@@ -61,7 +61,7 @@ static bool rtems_shell_register_command(const rtems_monitor_command_entry_t *e,
|
|||||||
shell_cmd->command = rtems_shell_main_monitor;
|
shell_cmd->command = rtems_shell_main_monitor;
|
||||||
shell_cmd->alias = NULL;
|
shell_cmd->alias = NULL;
|
||||||
shell_cmd->next = NULL;
|
shell_cmd->next = NULL;
|
||||||
|
|
||||||
if (rtems_shell_add_cmd_struct(shell_cmd) == NULL) {
|
if (rtems_shell_add_cmd_struct(shell_cmd) == NULL) {
|
||||||
free(shell_cmd);
|
free(shell_cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ jcl(rtems_shell_dd_globals* globals, char **argv)
|
|||||||
char *arg;
|
char *arg;
|
||||||
|
|
||||||
oper = NULL;
|
oper = NULL;
|
||||||
|
|
||||||
in.dbsz = out.dbsz = 512;
|
in.dbsz = out.dbsz = 512;
|
||||||
|
|
||||||
while ((oper = *++argv) != NULL) {
|
while ((oper = *++argv) != NULL) {
|
||||||
@@ -372,7 +372,7 @@ get_num(rtems_shell_dd_globals* globals, const char *val)
|
|||||||
num = strtouq(val, &expr, 0);
|
num = strtouq(val, &expr, 0);
|
||||||
if (errno != 0) /* Overflow or underflow. */
|
if (errno != 0) /* Overflow or underflow. */
|
||||||
err(exit_jump, 1, "%s", oper);
|
err(exit_jump, 1, "%s", oper);
|
||||||
|
|
||||||
if (expr == val) /* No valid digits. */
|
if (expr == val) /* No valid digits. */
|
||||||
errx(exit_jump, 1, "%s: illegal numeric value", oper);
|
errx(exit_jump, 1, "%s: illegal numeric value", oper);
|
||||||
|
|
||||||
@@ -446,7 +446,7 @@ get_off_t(rtems_shell_dd_globals* globals, const char *val)
|
|||||||
num = strtoq(val, &expr, 0);
|
num = strtoq(val, &expr, 0);
|
||||||
if (errno != 0) /* Overflow or underflow. */
|
if (errno != 0) /* Overflow or underflow. */
|
||||||
err(exit_jump, 1, "%s", oper);
|
err(exit_jump, 1, "%s", oper);
|
||||||
|
|
||||||
if (expr == val) /* No valid digits. */
|
if (expr == val) /* No valid digits. */
|
||||||
errx(exit_jump, 1, "%s: illegal numeric value", oper);
|
errx(exit_jump, 1, "%s: illegal numeric value", oper);
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ pos_out(rtems_shell_dd_globals* globals)
|
|||||||
off_t cnt;
|
off_t cnt;
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If not a tape, try seeking on the file. Seeking on a pipe is
|
* If not a tape, try seeking on the file. Seeking on a pipe is
|
||||||
* going to fail, but don't protect the user -- they shouldn't
|
* going to fail, but don't protect the user -- they shouldn't
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ fts_read(
|
|||||||
}
|
}
|
||||||
p->fts_info = FTS_DP;
|
p->fts_info = FTS_DP;
|
||||||
return (p);
|
return (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rebuild if only read the names and now traversing. */
|
/* Rebuild if only read the names and now traversing. */
|
||||||
if (sp->fts_child && ISSET(FTS_NAMEONLY)) {
|
if (sp->fts_child && ISSET(FTS_NAMEONLY)) {
|
||||||
@@ -571,7 +571,7 @@ fts_children(
|
|||||||
if (instr == FTS_NAMEONLY) {
|
if (instr == FTS_NAMEONLY) {
|
||||||
SET(FTS_NAMEONLY);
|
SET(FTS_NAMEONLY);
|
||||||
instr = BNAMES;
|
instr = BNAMES;
|
||||||
} else
|
} else
|
||||||
instr = BCHILD;
|
instr = BCHILD;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -777,7 +777,7 @@ mem1: saved_errno = errno;
|
|||||||
p->fts_accpath = cur->fts_accpath;
|
p->fts_accpath = cur->fts_accpath;
|
||||||
} else if (nlinks == 0
|
} else if (nlinks == 0
|
||||||
#ifdef DT_DIR
|
#ifdef DT_DIR
|
||||||
|| (nostat &&
|
|| (nostat &&
|
||||||
dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
|
dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
@@ -899,7 +899,7 @@ fts_stat(
|
|||||||
if (!lstat(p->fts_accpath, sbp)) {
|
if (!lstat(p->fts_accpath, sbp)) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
return (FTS_SLNONE);
|
return (FTS_SLNONE);
|
||||||
}
|
}
|
||||||
p->fts_errno = saved_errno;
|
p->fts_errno = saved_errno;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@@ -974,7 +974,7 @@ fts_sort(
|
|||||||
}
|
}
|
||||||
for (ap = sp->fts_array, p = head; p; p = p->fts_link)
|
for (ap = sp->fts_array, p = head; p; p = p->fts_link)
|
||||||
*ap++ = p;
|
*ap++ = p;
|
||||||
qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *),
|
qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *),
|
||||||
(int (*) __P((const void *, const void *)))sp->fts_compar);
|
(int (*) __P((const void *, const void *)))sp->fts_compar);
|
||||||
for (head = *(ap = sp->fts_array); --nitems; ++ap)
|
for (head = *(ap = sp->fts_array); --nitems; ++ap)
|
||||||
ap[0]->fts_link = ap[1];
|
ap[0]->fts_link = ap[1];
|
||||||
@@ -1081,7 +1081,7 @@ fts_pow2(
|
|||||||
* Allow essentially unlimited paths; find, rm, ls should all work on any tree.
|
* Allow essentially unlimited paths; find, rm, ls should all work on any tree.
|
||||||
* Most systems will allow creation of paths much longer than MAXPATHLEN, even
|
* Most systems will allow creation of paths much longer than MAXPATHLEN, even
|
||||||
* though the kernel won't resolve them. Round up the new size to a power of 2,
|
* though the kernel won't resolve them. Round up the new size to a power of 2,
|
||||||
* so we don't realloc the path 2 bytes at a time.
|
* so we don't realloc the path 2 bytes at a time.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
fts_palloc(
|
fts_palloc(
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ retry:
|
|||||||
if (!odmode) {
|
if (!odmode) {
|
||||||
*pr->cchar = 'c';
|
*pr->cchar = 'c';
|
||||||
(void)printf(pr->fmt, (int)wc);
|
(void)printf(pr->fmt, (int)wc);
|
||||||
} else {
|
} else {
|
||||||
*pr->cchar = 'C';
|
*pr->cchar = 'C';
|
||||||
assert(strcmp(pr->fmt, "%3C") == 0);
|
assert(strcmp(pr->fmt, "%3C") == 0);
|
||||||
width = wcwidth(wc);
|
width = wcwidth(wc);
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ get(rtems_shell_hexdump_globals* globals)
|
|||||||
* XXX bcmp() is not quite right in the presence
|
* XXX bcmp() is not quite right in the presence
|
||||||
* of multibyte characters.
|
* of multibyte characters.
|
||||||
*/
|
*/
|
||||||
if (vflag != ALL &&
|
if (vflag != ALL &&
|
||||||
valid_save &&
|
valid_save &&
|
||||||
bcmp(curp, savp, nread) == 0) {
|
bcmp(curp, savp, nread) == 0) {
|
||||||
if (vflag != DUP)
|
if (vflag != DUP)
|
||||||
(void)printf("*\n");
|
(void)printf("*\n");
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ oldsyntax(rtems_shell_hexdump_globals* globals, int argc, char ***argvp)
|
|||||||
char **argv, *end;
|
char **argv, *end;
|
||||||
|
|
||||||
struct getopt_data getopt_reent;
|
struct getopt_data getopt_reent;
|
||||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||||
|
|
||||||
/* Add initial (default) address format. -A may change it later. */
|
/* Add initial (default) address format. -A may change it later. */
|
||||||
#define TYPE_OFFSET 7
|
#define TYPE_OFFSET 7
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ newsyntax(rtems_shell_hexdump_globals* globals, int argc, char ***argvp)
|
|||||||
char *p, **argv;
|
char *p, **argv;
|
||||||
|
|
||||||
struct getopt_data getopt_reent;
|
struct getopt_data getopt_reent;
|
||||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||||
|
|
||||||
argv = *argvp;
|
argv = *argvp;
|
||||||
if ((p = rindex(argv[0], 'h')) != NULL &&
|
if ((p = rindex(argv[0], 'h')) != NULL &&
|
||||||
|
|||||||
@@ -10,42 +10,42 @@
|
|||||||
* Parts of this software was created by
|
* Parts of this software was created by
|
||||||
* Till Straumann <strauman@slac.stanford.edu>, 2003-2007
|
* Till Straumann <strauman@slac.stanford.edu>, 2003-2007
|
||||||
* Stanford Linear Accelerator Center, Stanford University.
|
* Stanford Linear Accelerator Center, Stanford University.
|
||||||
*
|
*
|
||||||
* Acknowledgement of sponsorship
|
* Acknowledgement of sponsorship
|
||||||
* ------------------------------
|
* ------------------------------
|
||||||
* Parts of this software was produced by
|
* Parts of this software was produced by
|
||||||
* the Stanford Linear Accelerator Center, Stanford University,
|
* the Stanford Linear Accelerator Center, Stanford University,
|
||||||
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
|
* under Contract DE-AC03-76SFO0515 with the Department of Energy.
|
||||||
*
|
*
|
||||||
* Government disclaimer of liability
|
* Government disclaimer of liability
|
||||||
* ----------------------------------
|
* ----------------------------------
|
||||||
* Neither the United States nor the United States Department of Energy,
|
* Neither the United States nor the United States Department of Energy,
|
||||||
* nor any of their employees, makes any warranty, express or implied, or
|
* nor any of their employees, makes any warranty, express or implied, or
|
||||||
* assumes any legal liability or responsibility for the accuracy,
|
* assumes any legal liability or responsibility for the accuracy,
|
||||||
* completeness, or usefulness of any data, apparatus, product, or process
|
* completeness, or usefulness of any data, apparatus, product, or process
|
||||||
* disclosed, or represents that its use would not infringe privately owned
|
* disclosed, or represents that its use would not infringe privately owned
|
||||||
* rights.
|
* rights.
|
||||||
*
|
*
|
||||||
* Stanford disclaimer of liability
|
* Stanford disclaimer of liability
|
||||||
* --------------------------------
|
* --------------------------------
|
||||||
* Stanford University makes no representations or warranties, express or
|
* Stanford University makes no representations or warranties, express or
|
||||||
* implied, nor assumes any liability for the use of this software.
|
* implied, nor assumes any liability for the use of this software.
|
||||||
*
|
*
|
||||||
* Stanford disclaimer of copyright
|
* Stanford disclaimer of copyright
|
||||||
* --------------------------------
|
* --------------------------------
|
||||||
* Stanford University, owner of the copyright, hereby disclaims its
|
* Stanford University, owner of the copyright, hereby disclaims its
|
||||||
* copyright and all other rights in this software. Hence, anyone may
|
* copyright and all other rights in this software. Hence, anyone may
|
||||||
* freely use it for any purpose without restriction.
|
* freely use it for any purpose without restriction.
|
||||||
*
|
*
|
||||||
* Maintenance of notices
|
* Maintenance of notices
|
||||||
* ----------------------
|
* ----------------------
|
||||||
* In the interest of clarity regarding the origin and status of this
|
* In the interest of clarity regarding the origin and status of this
|
||||||
* SLAC software, this and all the preceding Stanford University notices
|
* SLAC software, this and all the preceding Stanford University notices
|
||||||
* are to remain affixed to any copy or derivative of this software made
|
* are to remain affixed to any copy or derivative of this software made
|
||||||
* or distributed by the recipient and are to be affixed to any copy of
|
* or distributed by the recipient and are to be affixed to any copy of
|
||||||
* software made or distributed by the recipient that contains a copy or
|
* software made or distributed by the recipient that contains a copy or
|
||||||
* derivative of this software.
|
* derivative of this software.
|
||||||
*
|
*
|
||||||
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
|
* ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
|
||||||
*
|
*
|
||||||
* Copyright (c) 2009 embedded brains GmbH and others.
|
* Copyright (c) 2009 embedded brains GmbH and others.
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ int rtems_shell_main_blksync(
|
|||||||
const char* driver = NULL;
|
const char* driver = NULL;
|
||||||
int arg;
|
int arg;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
for (arg = 1; arg < argc; arg++) {
|
for (arg = 1; arg < argc; arg++) {
|
||||||
if (argv[arg][0] == '-') {
|
if (argv[arg][0] == '-') {
|
||||||
fprintf( stderr, "%s: invalid option: %s\n", argv[0], argv[arg]);
|
fprintf( stderr, "%s: invalid option: %s\n", argv[0], argv[arg]);
|
||||||
@@ -51,18 +51,18 @@ int rtems_shell_main_blksync(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open (driver, O_WRONLY, 0);
|
fd = open (driver, O_WRONLY, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf( stderr, "%s: driver open failed: %s\n", argv[0], strerror (errno));
|
fprintf( stderr, "%s: driver open failed: %s\n", argv[0], strerror (errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl (fd, RTEMS_BLKIO_SYNCDEV) < 0) {
|
if (ioctl (fd, RTEMS_BLKIO_SYNCDEV) < 0) {
|
||||||
fprintf( stderr, "%s: driver sync failed: %s\n", argv[0], strerror (errno));
|
fprintf( stderr, "%s: driver sync failed: %s\n", argv[0], strerror (errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
close (fd);
|
close (fd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ __RCSID("$NetBSD: cp.c,v 1.39 2005/10/24 12:59:07 kleink Exp $");
|
|||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Cp copies source files to target files.
|
* Cp copies source files to target files.
|
||||||
*
|
*
|
||||||
* The global PATH_T structure "to" always contains the path to the
|
* The global PATH_T structure "to" always contains the path to the
|
||||||
* current target file. Since fts(3) does not change directories,
|
* current target file. Since fts(3) does not change directories,
|
||||||
* this path can be either absolute or dot-relative.
|
* this path can be either absolute or dot-relative.
|
||||||
*
|
*
|
||||||
* The basic algorithm is to initialize "to" and use fts(3) to traverse
|
* The basic algorithm is to initialize "to" and use fts(3) to traverse
|
||||||
* the file hierarchy rooted in the argument list. A trivial case is the
|
* the file hierarchy rooted in the argument list. A trivial case is the
|
||||||
* case of 'cp file1 file2'. The more interesting case is the case of
|
* case of 'cp file1 file2'. The more interesting case is the case of
|
||||||
@@ -129,7 +129,7 @@ main_cp(rtems_shell_cp_globals* cp_globals, int argc, char *argv[])
|
|||||||
struct getopt_data getopt_reent;
|
struct getopt_data getopt_reent;
|
||||||
|
|
||||||
Hflag = Lflag = Pflag = 0;
|
Hflag = Lflag = Pflag = 0;
|
||||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||||
|
|
||||||
while ((ch = getopt_r(argc, argv, "HLPRafilnprv", &getopt_reent)) != -1)
|
while ((ch = getopt_r(argc, argv, "HLPRafilnprv", &getopt_reent)) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
@@ -208,7 +208,7 @@ main_cp(rtems_shell_cp_globals* cp_globals, int argc, char *argv[])
|
|||||||
#if 0
|
#if 0
|
||||||
(void)signal(SIGINFO, siginfo);
|
(void)signal(SIGINFO, siginfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Save the target base in "to". */
|
/* Save the target base in "to". */
|
||||||
target = argv[--argc];
|
target = argv[--argc];
|
||||||
if (strlcpy(to.p_path, target, sizeof(to.p_path)) >= sizeof(to.p_path))
|
if (strlcpy(to.p_path, target, sizeof(to.p_path)) >= sizeof(to.p_path))
|
||||||
@@ -446,7 +446,7 @@ copy(rtems_shell_cp_globals* cp_globals,
|
|||||||
curr->fts_level == 0)) {
|
curr->fts_level == 0)) {
|
||||||
if (copy_file(cp_globals, curr, dne))
|
if (copy_file(cp_globals, curr, dne))
|
||||||
badcp = rval = 1;
|
badcp = rval = 1;
|
||||||
} else {
|
} else {
|
||||||
if (copy_link(cp_globals, curr, !dne))
|
if (copy_link(cp_globals, curr, !dne))
|
||||||
badcp = rval = 1;
|
badcp = rval = 1;
|
||||||
}
|
}
|
||||||
@@ -552,4 +552,4 @@ rtems_shell_cmd_t rtems_shell_CP_Command = {
|
|||||||
NULL, /* alias */
|
NULL, /* alias */
|
||||||
NULL /* next */
|
NULL /* next */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ int rtems_shell_main_date(
|
|||||||
|
|
||||||
sprintf( buf, "%s %s", argv[1], argv[2] );
|
sprintf( buf, "%s %s", argv[1], argv[2] );
|
||||||
result = strptime(
|
result = strptime(
|
||||||
buf,
|
buf,
|
||||||
"%Y-%m-%d %T",
|
"%Y-%m-%d %T",
|
||||||
&TOD
|
&TOD
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ parity(u_char c)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = c ^ (c >> 1) ^ (c >> 2) ^ (c >> 3) ^
|
i = c ^ (c >> 1) ^ (c >> 2) ^ (c >> 3) ^
|
||||||
(c >> 4) ^ (c >> 5) ^ (c >> 6) ^ (c >> 7);
|
(c >> 4) ^ (c >> 5) ^ (c >> 6) ^ (c >> 7);
|
||||||
return (i & 1);
|
return (i & 1);
|
||||||
}
|
}
|
||||||
@@ -285,7 +285,7 @@ setup(rtems_shell_dd_globals* globals)
|
|||||||
}
|
}
|
||||||
|
|
||||||
(void)gettimeofday(&tv, (struct timezone *)NULL);
|
(void)gettimeofday(&tv, (struct timezone *)NULL);
|
||||||
st.start = tv.tv_sec + tv.tv_usec * 1e-6;
|
st.start = tv.tv_sec + tv.tv_usec * 1e-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -301,7 +301,7 @@ getfdtype(rtems_shell_dd_globals* globals, IO *io)
|
|||||||
if (S_ISREG(sb.st_mode))
|
if (S_ISREG(sb.st_mode))
|
||||||
io->flags |= ISTRUNC;
|
io->flags |= ISTRUNC;
|
||||||
#if RTEMS_REMOVED
|
#if RTEMS_REMOVED
|
||||||
if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) {
|
if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode)) {
|
||||||
if (ioctl(io->fd, FIODTYPE, &type) == -1) {
|
if (ioctl(io->fd, FIODTYPE, &type) == -1) {
|
||||||
err(exit_jump, 1, "%s", io->name);
|
err(exit_jump, 1, "%s", io->name);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ int rtems_shell_main_getenv(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf ("%s\n", string);
|
printf ("%s\n", string);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ main_hexdump(rtems_shell_hexdump_globals* globals, int argc, char *argv[])
|
|||||||
#if RTEMS_REMOVED
|
#if RTEMS_REMOVED
|
||||||
(void)setlocale(LC_ALL, "");
|
(void)setlocale(LC_ALL, "");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(p = rindex(argv[0], 'o')) || strcmp(p, "od"))
|
if (!(p = rindex(argv[0], 'o')) || strcmp(p, "od"))
|
||||||
newsyntax(globals, argc, &argv);
|
newsyntax(globals, argc, &argv);
|
||||||
else
|
else
|
||||||
@@ -158,4 +158,4 @@ rtems_shell_cmd_t rtems_shell_HEXDUMP_Command = {
|
|||||||
NULL, /* alias */
|
NULL, /* alias */
|
||||||
NULL /* next */
|
NULL /* next */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -53,19 +53,19 @@ int rtems_shell_main_ifconfig(
|
|||||||
memset(&dstaddr, 0, sizeof(dstaddr));
|
memset(&dstaddr, 0, sizeof(dstaddr));
|
||||||
memset(&netmask, 0, sizeof(netmask));
|
memset(&netmask, 0, sizeof(netmask));
|
||||||
memset(&broadcast, 0, sizeof(broadcast));
|
memset(&broadcast, 0, sizeof(broadcast));
|
||||||
|
|
||||||
ipaddr.sin_len = sizeof(ipaddr);
|
ipaddr.sin_len = sizeof(ipaddr);
|
||||||
ipaddr.sin_family = AF_INET;
|
ipaddr.sin_family = AF_INET;
|
||||||
|
|
||||||
dstaddr.sin_len = sizeof(dstaddr);
|
dstaddr.sin_len = sizeof(dstaddr);
|
||||||
dstaddr.sin_family = AF_INET;
|
dstaddr.sin_family = AF_INET;
|
||||||
|
|
||||||
netmask.sin_len = sizeof(netmask);
|
netmask.sin_len = sizeof(netmask);
|
||||||
netmask.sin_family = AF_INET;
|
netmask.sin_family = AF_INET;
|
||||||
|
|
||||||
broadcast.sin_len = sizeof(broadcast);
|
broadcast.sin_len = sizeof(broadcast);
|
||||||
broadcast.sin_family = AF_INET;
|
broadcast.sin_family = AF_INET;
|
||||||
|
|
||||||
cur_idx = 0;
|
cur_idx = 0;
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
/* display all interfaces */
|
/* display all interfaces */
|
||||||
@@ -84,11 +84,11 @@ int rtems_shell_main_ifconfig(
|
|||||||
cur_idx += 2;
|
cur_idx += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((f_down !=0) && (f_ip != 0)) {
|
if ((f_down !=0) && (f_ip != 0)) {
|
||||||
f_up = 1;
|
f_up = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(argc > cur_idx) {
|
while(argc > cur_idx) {
|
||||||
if (strcmp(argv[cur_idx], "up") == 0) {
|
if (strcmp(argv[cur_idx], "up") == 0) {
|
||||||
f_up = 1;
|
f_up = 1;
|
||||||
@@ -104,7 +104,7 @@ int rtems_shell_main_ifconfig(
|
|||||||
if ((cur_idx + 1) >= argc) {
|
if ((cur_idx + 1) >= argc) {
|
||||||
printf("No netmask address\n");
|
printf("No netmask address\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (inet_pton(AF_INET, argv[cur_idx+1], &netmask.sin_addr) < 0) {
|
if (inet_pton(AF_INET, argv[cur_idx+1], &netmask.sin_addr) < 0) {
|
||||||
printf("bad netmask: %s\n", argv[cur_idx]);
|
printf("bad netmask: %s\n", argv[cur_idx]);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -115,7 +115,7 @@ int rtems_shell_main_ifconfig(
|
|||||||
if ((cur_idx + 1) >= argc) {
|
if ((cur_idx + 1) >= argc) {
|
||||||
printf("No broadcast address\n");
|
printf("No broadcast address\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (inet_pton(AF_INET, argv[cur_idx+1], &broadcast.sin_addr) < 0) {
|
if (inet_pton(AF_INET, argv[cur_idx+1], &broadcast.sin_addr) < 0) {
|
||||||
printf("bad broadcast: %s\n", argv[cur_idx]);
|
printf("bad broadcast: %s\n", argv[cur_idx]);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -126,7 +126,7 @@ int rtems_shell_main_ifconfig(
|
|||||||
if ((cur_idx + 1) >= argc) {
|
if ((cur_idx + 1) >= argc) {
|
||||||
printf("No pointopoint address\n");
|
printf("No pointopoint address\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (inet_pton(AF_INET, argv[cur_idx+1], &dstaddr.sin_addr) < 0) {
|
if (inet_pton(AF_INET, argv[cur_idx+1], &dstaddr.sin_addr) < 0) {
|
||||||
printf("bad pointopoint: %s\n", argv[cur_idx]);
|
printf("bad pointopoint: %s\n", argv[cur_idx]);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -139,7 +139,7 @@ int rtems_shell_main_ifconfig(
|
|||||||
}
|
}
|
||||||
cur_idx += 1;
|
cur_idx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("ifconfig ");
|
printf("ifconfig ");
|
||||||
if (iface != NULL) {
|
if (iface != NULL) {
|
||||||
printf("%s ", iface);
|
printf("%s ", iface);
|
||||||
@@ -148,25 +148,25 @@ int rtems_shell_main_ifconfig(
|
|||||||
inet_ntop(AF_INET, &ipaddr.sin_addr, str, 256);
|
inet_ntop(AF_INET, &ipaddr.sin_addr, str, 256);
|
||||||
printf("%s ", str);
|
printf("%s ", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_netmask != 0) {
|
if (f_netmask != 0) {
|
||||||
char str[256];
|
char str[256];
|
||||||
inet_ntop(AF_INET, &netmask.sin_addr, str, 256);
|
inet_ntop(AF_INET, &netmask.sin_addr, str, 256);
|
||||||
printf("netmask %s ", str);
|
printf("netmask %s ", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_bcast != 0) {
|
if (f_bcast != 0) {
|
||||||
char str[256];
|
char str[256];
|
||||||
inet_ntop(AF_INET, &broadcast.sin_addr, str, 256);
|
inet_ntop(AF_INET, &broadcast.sin_addr, str, 256);
|
||||||
printf("broadcast %s ", str);
|
printf("broadcast %s ", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_ptp != 0) {
|
if (f_ptp != 0) {
|
||||||
char str[256];
|
char str[256];
|
||||||
inet_ntop(AF_INET, &dstaddr.sin_addr, str, 256);
|
inet_ntop(AF_INET, &dstaddr.sin_addr, str, 256);
|
||||||
printf("pointopoint %s ", str);
|
printf("pointopoint %s ", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_up != 0) {
|
if (f_up != 0) {
|
||||||
printf("up\n");
|
printf("up\n");
|
||||||
} else if (f_down != 0) {
|
} else if (f_down != 0) {
|
||||||
@@ -175,12 +175,12 @@ int rtems_shell_main_ifconfig(
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((iface == NULL) || ((f_ip == 0) && (f_down == 0) && (f_up == 0))) {
|
if ((iface == NULL) || ((f_ip == 0) && (f_down == 0) && (f_up == 0))) {
|
||||||
rtems_bsdnet_show_if_stats();
|
rtems_bsdnet_show_if_stats();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
if (f_netmask) {
|
if (f_netmask) {
|
||||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFNETMASK, &netmask);
|
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFNETMASK, &netmask);
|
||||||
@@ -189,7 +189,7 @@ int rtems_shell_main_ifconfig(
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_bcast) {
|
if (f_bcast) {
|
||||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFBRDADDR, &broadcast);
|
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFBRDADDR, &broadcast);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@@ -197,7 +197,7 @@ int rtems_shell_main_ifconfig(
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_ptp) {
|
if (f_ptp) {
|
||||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFDSTADDR, &dstaddr);
|
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFDSTADDR, &dstaddr);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@@ -206,8 +206,8 @@ int rtems_shell_main_ifconfig(
|
|||||||
}
|
}
|
||||||
flags |= IFF_POINTOPOINT;
|
flags |= IFF_POINTOPOINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This must come _after_ setting the netmask, broadcast addresses */
|
/* This must come _after_ setting the netmask, broadcast addresses */
|
||||||
if (f_ip) {
|
if (f_ip) {
|
||||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFADDR, &ipaddr);
|
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFADDR, &ipaddr);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@@ -215,15 +215,15 @@ int rtems_shell_main_ifconfig(
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_up != 0) {
|
if (f_up != 0) {
|
||||||
flags |= IFF_UP;
|
flags |= IFF_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f_down != 0) {
|
if (f_down != 0) {
|
||||||
printf("Warning: taking interfaces down is not supported\n");
|
printf("Warning: taking interfaces down is not supported\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFFLAGS, &flags);
|
rc = rtems_bsdnet_ifconfig(iface, SIOCSIFFLAGS, &flags);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
printf("Could not set interface flags: %s\n", strerror(errno));
|
printf("Could not set interface flags: %s\n", strerror(errno));
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ main_ln(rtems_shell_ln_globals* globals, int argc, char *argv[])
|
|||||||
setprogname(argv[0]);
|
setprogname(argv[0]);
|
||||||
(void)setlocale(LC_ALL, "");
|
(void)setlocale(LC_ALL, "");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((ch = getopt_r(argc, argv, "fhinsv", &getopt_reent)) != -1)
|
while ((ch = getopt_r(argc, argv, "fhinsv", &getopt_reent)) != -1)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'f':
|
case 'f':
|
||||||
@@ -159,7 +159,7 @@ main_ln(rtems_shell_ln_globals* globals, int argc, char *argv[])
|
|||||||
case 's':
|
case 's':
|
||||||
sflag = 1;
|
sflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
vflag = 1;
|
vflag = 1;
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ main_ls(rtems_shell_ls_globals* globals, int argc, char *argv[])
|
|||||||
|
|
||||||
struct getopt_data getopt_reent;
|
struct getopt_data getopt_reent;
|
||||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||||
|
|
||||||
#if RTEMS_REMOVED
|
#if RTEMS_REMOVED
|
||||||
setprogname(argv[0]);
|
setprogname(argv[0]);
|
||||||
#endif
|
#endif
|
||||||
@@ -452,7 +452,7 @@ traverse(rtems_shell_ls_globals* globals, int argc, char *argv[], int options)
|
|||||||
fts_close(ftsp);
|
fts_close(ftsp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If not recursing down this tree and don't need stat info, just get
|
* If not recursing down this tree and don't need stat info, just get
|
||||||
* the names.
|
* the names.
|
||||||
@@ -701,7 +701,7 @@ mastercmp_no_listdir(const FTSENT **a, const FTSENT **b)
|
|||||||
{
|
{
|
||||||
int a_info, b_info;
|
int a_info, b_info;
|
||||||
int l_f_listdir = 0;
|
int l_f_listdir = 0;
|
||||||
|
|
||||||
a_info = (*a)->fts_info;
|
a_info = (*a)->fts_info;
|
||||||
if (a_info == FTS_ERR)
|
if (a_info == FTS_ERR)
|
||||||
return (0);
|
return (0);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ int rtems_shell_main_mdump(
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (max <= 0) {
|
if (max <= 0) {
|
||||||
max = 1; /* print 1 item if 0 or neg. */
|
max = 1; /* print 1 item if 0 or neg. */
|
||||||
res = 0;
|
res = 0;
|
||||||
} else {
|
} else {
|
||||||
max--;
|
max--;
|
||||||
|
|||||||
@@ -62,13 +62,13 @@ int rtems_shell_libc_mounter(
|
|||||||
/*
|
/*
|
||||||
* Mount the disk.
|
* Mount the disk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (mount (&mt_entry, fs->fs_ops, options, (char*) driver, (char*) path) < 0)
|
if (mount (&mt_entry, fs->fs_ops, options, (char*) driver, (char*) path) < 0)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "mount: mount failed: %s\n", strerror (errno));
|
fprintf (stderr, "mount: mount failed: %s\n", strerror (errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ int rtems_shell_main_mount(
|
|||||||
int arg;
|
int arg;
|
||||||
|
|
||||||
rtems_shell_mount_fsys_init();
|
rtems_shell_mount_fsys_init();
|
||||||
|
|
||||||
for (arg = 1; arg < argc; arg++) {
|
for (arg = 1; arg < argc; arg++) {
|
||||||
if (argv[arg][0] == '-') {
|
if (argv[arg][0] == '-') {
|
||||||
if (argv[arg][1] == 't') {
|
if (argv[arg][1] == 't') {
|
||||||
@@ -159,26 +159,26 @@ int rtems_shell_main_mount(
|
|||||||
fprintf (stderr, "mount: no file-system; see the -L option\n");
|
fprintf (stderr, "mount: no file-system; see the -L option\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs->driver_needed && !driver) {
|
if (fs->driver_needed && !driver) {
|
||||||
fprintf (stderr, "mount: no driver\n");
|
fprintf (stderr, "mount: no driver\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mount_point) {
|
if (!mount_point) {
|
||||||
fprintf (stderr, "mount: no mount point\n");
|
fprintf (stderr, "mount: no mount point\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mount the disk.
|
* Mount the disk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (fs->mounter (driver, mount_point, fs, options))
|
if (fs->mounter (driver, mount_point, fs, options))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
printf ("mounted %s -> %s\n", driver, mount_point);
|
printf ("mounted %s -> %s\n", driver, mount_point);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,12 +49,12 @@ rtems_shell_nfs_mounter (
|
|||||||
}
|
}
|
||||||
|
|
||||||
nfsInit (0, 0);
|
nfsInit (0, 0);
|
||||||
|
|
||||||
uidhost = strdup (device);
|
uidhost = strdup (device);
|
||||||
path = strchr (uidhost, ':');
|
path = strchr (uidhost, ':');
|
||||||
*path = '\0';
|
*path = '\0';
|
||||||
path++;
|
path++;
|
||||||
|
|
||||||
ret = nfsMount(uidhost, path, (char*) mntpoint);
|
ret = nfsMount(uidhost, path, (char*) mntpoint);
|
||||||
|
|
||||||
free (uidhost);
|
free (uidhost);
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ int rtems_shell_main_msdos_format(
|
|||||||
cluster_align: 0,
|
cluster_align: 0,
|
||||||
info_level: 0
|
info_level: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned long tmp;
|
unsigned long tmp;
|
||||||
const char* driver = NULL;
|
const char* driver = NULL;
|
||||||
int arg;
|
int arg;
|
||||||
|
|
||||||
for (arg = 1; arg < argc; arg++) {
|
for (arg = 1; arg < argc; arg++) {
|
||||||
if (argv[arg][0] == '-') {
|
if (argv[arg][0] == '-') {
|
||||||
switch (argv[arg][1]) {
|
switch (argv[arg][1]) {
|
||||||
@@ -74,7 +74,7 @@ int rtems_shell_main_msdos_format(
|
|||||||
|
|
||||||
rqdata.sectors_per_cluster = (uint32_t) tmp;
|
rqdata.sectors_per_cluster = (uint32_t) tmp;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
arg++;
|
arg++;
|
||||||
if (arg == argc) {
|
if (arg == argc) {
|
||||||
@@ -92,7 +92,7 @@ int rtems_shell_main_msdos_format(
|
|||||||
|
|
||||||
rqdata.files_per_root_dir = (uint32_t) tmp;
|
rqdata.files_per_root_dir = (uint32_t) tmp;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
arg++;
|
arg++;
|
||||||
if (arg == argc) {
|
if (arg == argc) {
|
||||||
@@ -117,11 +117,11 @@ int rtems_shell_main_msdos_format(
|
|||||||
case 'v':
|
case 'v':
|
||||||
rqdata.info_level++;
|
rqdata.info_level++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "error: invalid option: %s\n", argv[arg]);
|
fprintf (stderr, "error: invalid option: %s\n", argv[arg]);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!driver)
|
if (!driver)
|
||||||
@@ -137,7 +137,7 @@ int rtems_shell_main_msdos_format(
|
|||||||
fprintf (stderr, "error: no driver\n");
|
fprintf (stderr, "error: no driver\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("msdos format: %s\n", driver);
|
printf ("msdos format: %s\n", driver);
|
||||||
|
|
||||||
if (rqdata.info_level)
|
if (rqdata.info_level)
|
||||||
@@ -152,7 +152,7 @@ int rtems_shell_main_msdos_format(
|
|||||||
printf (" %-20s: %d\n", "quick_format", rqdata.quick_format);
|
printf (" %-20s: %d\n", "quick_format", rqdata.quick_format);
|
||||||
printf (" %-20s: %lu\n", "cluster align", rqdata.cluster_align);
|
printf (" %-20s: %lu\n", "cluster align", rqdata.cluster_align);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msdos_format (driver, &rqdata) < 0) {
|
if (msdos_format (driver, &rqdata) < 0) {
|
||||||
fprintf (stderr, "error: format failed: %s\n", strerror (errno));
|
fprintf (stderr, "error: format failed: %s\n", strerror (errno));
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ rtems_shell_main_mv(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define do_move(a1, a2) do_move_mv(globals, a1, a2)
|
#define do_move(a1, a2) do_move_mv(globals, a1, a2)
|
||||||
#define fastcopy(a1, a2, a3) fastcopy_mv(globals, a1, a2, a3)
|
#define fastcopy(a1, a2, a3) fastcopy_mv(globals, a1, a2, a3)
|
||||||
#define copy(a1, a2) copy_mv(globals, a1, a2)
|
#define copy(a1, a2) copy_mv(globals, a1, a2)
|
||||||
#define usage() usage_mv(globals)
|
#define usage() usage_mv(globals)
|
||||||
|
|
||||||
static int do_move_mv(rtems_shell_mv_globals* globals, char *from, char *to);
|
static int do_move_mv(rtems_shell_mv_globals* globals, char *from, char *to);
|
||||||
@@ -151,9 +151,9 @@ main_mv(rtems_shell_mv_globals* globals, int argc, char *argv[])
|
|||||||
|
|
||||||
struct getopt_data getopt_reent;
|
struct getopt_data getopt_reent;
|
||||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||||
|
|
||||||
/* setprogname(argv[0]); */
|
/* setprogname(argv[0]); */
|
||||||
|
|
||||||
(void)setlocale(LC_ALL, "");
|
(void)setlocale(LC_ALL, "");
|
||||||
|
|
||||||
while ((ch = getopt_r(argc, argv, "ifv", &getopt_reent)) != -1)
|
while ((ch = getopt_r(argc, argv, "ifv", &getopt_reent)) != -1)
|
||||||
@@ -331,7 +331,7 @@ fastcopy_mv(rtems_shell_mv_globals* globals, char *from, char *to, struct stat *
|
|||||||
int nread, from_fd, to_fd;
|
int nread, from_fd, to_fd;
|
||||||
|
|
||||||
blen = 0;
|
blen = 0;
|
||||||
|
|
||||||
if ((from_fd = open(from, O_RDONLY, 0)) < 0) {
|
if ((from_fd = open(from, O_RDONLY, 0)) < 0) {
|
||||||
warn("%s", from);
|
warn("%s", from);
|
||||||
return (1);
|
return (1);
|
||||||
@@ -363,7 +363,7 @@ err: if (unlink(to))
|
|||||||
(void)close(to_fd);
|
(void)close(to_fd);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)free(bp);
|
(void)free(bp);
|
||||||
(void)close(from_fd);
|
(void)close(from_fd);
|
||||||
#ifdef xBSD4_4
|
#ifdef xBSD4_4
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ int rtems_shell_main_mwdump(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (max <= 0) {
|
if (max <= 0) {
|
||||||
max = 1; /* print 1 item if 0 or neg. */
|
max = 1; /* print 1 item if 0 or neg. */
|
||||||
res = 0;
|
res = 0;
|
||||||
} else {
|
} else {
|
||||||
max--;
|
max--;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ int rtems_shell_main_netstats( /* command */
|
|||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
struct getopt_data getopt_reent;
|
struct getopt_data getopt_reent;
|
||||||
|
|
||||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||||
while ( (option = getopt_r( argc, argv, "Aimfpcutv", &getopt_reent)) != -1 ) {
|
while ( (option = getopt_r( argc, argv, "Aimfpcutv", &getopt_reent)) != -1 ) {
|
||||||
|
|
||||||
switch ((char)option) {
|
switch ((char)option) {
|
||||||
@@ -75,7 +75,7 @@ int rtems_shell_main_netstats( /* command */
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
printf(
|
printf(
|
||||||
"doAll=%d\n"
|
"doAll=%d\n"
|
||||||
|
|||||||
@@ -145,10 +145,10 @@ main_rm(rtems_shell_rm_globals* globals, int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
struct getopt_data getopt_reent;
|
struct getopt_data getopt_reent;
|
||||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test for the special case where the utility is called as
|
* Test for the special case where the utility is called as
|
||||||
* "unlink", for which the functionality provided is greatly
|
* "unlink", for which the functionality provided is greatly
|
||||||
|
|||||||
@@ -41,28 +41,28 @@ int rtems_shell_main_route(
|
|||||||
int cur_idx;
|
int cur_idx;
|
||||||
int flags;
|
int flags;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
memset(&dst, 0, sizeof(dst));
|
memset(&dst, 0, sizeof(dst));
|
||||||
memset(&gw, 0, sizeof(gw));
|
memset(&gw, 0, sizeof(gw));
|
||||||
memset(&netmask, 0, sizeof(netmask));
|
memset(&netmask, 0, sizeof(netmask));
|
||||||
|
|
||||||
dst.sin_len = sizeof(dst);
|
dst.sin_len = sizeof(dst);
|
||||||
dst.sin_family = AF_INET;
|
dst.sin_family = AF_INET;
|
||||||
dst.sin_addr.s_addr = inet_addr("0.0.0.0");
|
dst.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||||
|
|
||||||
gw.sin_len = sizeof(gw);
|
gw.sin_len = sizeof(gw);
|
||||||
gw.sin_family = AF_INET;
|
gw.sin_family = AF_INET;
|
||||||
gw.sin_addr.s_addr = inet_addr("0.0.0.0");
|
gw.sin_addr.s_addr = inet_addr("0.0.0.0");
|
||||||
|
|
||||||
netmask.sin_len = sizeof(netmask);
|
netmask.sin_len = sizeof(netmask);
|
||||||
netmask.sin_family = AF_INET;
|
netmask.sin_family = AF_INET;
|
||||||
netmask.sin_addr.s_addr = inet_addr("255.255.255.0");
|
netmask.sin_addr.s_addr = inet_addr("255.255.255.0");
|
||||||
|
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
rtems_bsdnet_show_inet_routes();
|
rtems_bsdnet_show_inet_routes();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[1], "add") == 0) {
|
if (strcmp(argv[1], "add") == 0) {
|
||||||
cmd = RTM_ADD;
|
cmd = RTM_ADD;
|
||||||
} else if (strcmp(argv[1], "del") == 0) {
|
} else if (strcmp(argv[1], "del") == 0) {
|
||||||
@@ -72,12 +72,12 @@ int rtems_shell_main_route(
|
|||||||
printf("\tit should be 'add' or 'del'\n");
|
printf("\tit should be 'add' or 'del'\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
printf("not enough arguments\n");
|
printf("not enough arguments\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[2], "-host") == 0) {
|
if (strcmp(argv[2], "-host") == 0) {
|
||||||
f_host = 1;
|
f_host = 1;
|
||||||
} else if (strcmp(argv[2], "-net") == 0) {
|
} else if (strcmp(argv[2], "-net") == 0) {
|
||||||
@@ -87,14 +87,14 @@ int rtems_shell_main_route(
|
|||||||
printf("\tit should be '-host' or '-net'\n");
|
printf("\tit should be '-host' or '-net'\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc < 4) {
|
if (argc < 4) {
|
||||||
printf("not enough arguments\n");
|
printf("not enough arguments\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inet_pton(AF_INET, argv[3], &dst.sin_addr);
|
inet_pton(AF_INET, argv[3], &dst.sin_addr);
|
||||||
|
|
||||||
cur_idx = 4;
|
cur_idx = 4;
|
||||||
while(cur_idx < argc) {
|
while(cur_idx < argc) {
|
||||||
if (strcmp(argv[cur_idx], "gw") == 0) {
|
if (strcmp(argv[cur_idx], "gw") == 0) {
|
||||||
@@ -119,7 +119,7 @@ int rtems_shell_main_route(
|
|||||||
}
|
}
|
||||||
cur_idx += 1;
|
cur_idx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = RTF_STATIC;
|
flags = RTF_STATIC;
|
||||||
if (f_gw != 0) {
|
if (f_gw != 0) {
|
||||||
flags |= RTF_GATEWAY;
|
flags |= RTF_GATEWAY;
|
||||||
|
|||||||
@@ -31,20 +31,20 @@ int rtems_shell_main_setenv(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
env = argv[1];
|
env = argv[1];
|
||||||
|
|
||||||
for (arg = 2; arg < argc; arg++)
|
for (arg = 2; arg < argc; arg++)
|
||||||
len += strlen (argv[arg]);
|
len += strlen (argv[arg]);
|
||||||
|
|
||||||
len += argc - 2 - 1;
|
len += argc - 2 - 1;
|
||||||
|
|
||||||
string = malloc (len + 1);
|
string = malloc (len + 1);
|
||||||
|
|
||||||
if (!string)
|
if (!string)
|
||||||
{
|
{
|
||||||
printf ("error: no memory\n");
|
printf ("error: no memory\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (arg = 2, p = string; arg < argc; arg++)
|
for (arg = 2, p = string; arg < argc; arg++)
|
||||||
{
|
{
|
||||||
strcpy (p, argv[arg]);
|
strcpy (p, argv[arg]);
|
||||||
@@ -55,7 +55,7 @@ int rtems_shell_main_setenv(int argc, char *argv[])
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setenv (env, string, 1) < 0)
|
if (setenv (env, string, 1) < 0)
|
||||||
{
|
{
|
||||||
printf ("error: %s\n", strerror (errno));
|
printf ("error: %s\n", strerror (errno));
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ int rtems_shell_main_time(
|
|||||||
sc = rtems_clock_get_uptime(&start);
|
sc = rtems_clock_get_uptime(&start);
|
||||||
if (sc != RTEMS_SUCCESSFUL)
|
if (sc != RTEMS_SUCCESSFUL)
|
||||||
printf("error: cannot read time\n");
|
printf("error: cannot read time\n");
|
||||||
|
|
||||||
if (argc) {
|
if (argc) {
|
||||||
shell_cmd = rtems_shell_lookup_cmd(argv[1]);
|
shell_cmd = rtems_shell_lookup_cmd(argv[1]);
|
||||||
if ( argv[1] == NULL ) {
|
if ( argv[1] == NULL ) {
|
||||||
@@ -65,12 +65,12 @@ int rtems_shell_main_time(
|
|||||||
--period.tv_sec;
|
--period.tv_sec;
|
||||||
period.tv_nsec += 1000000000UL;
|
period.tv_nsec += 1000000000UL;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("time: %li:%02li:%02li.%03li\n",
|
printf("time: %li:%02li:%02li.%03li\n",
|
||||||
period.tv_sec / 3600,
|
period.tv_sec / 3600,
|
||||||
period.tv_sec / 60, period.tv_sec % 60,
|
period.tv_sec / 60, period.tv_sec % 60,
|
||||||
period.tv_nsec / 1000000);
|
period.tv_nsec / 1000000);
|
||||||
|
|
||||||
return errorlevel;
|
return errorlevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ int rtems_shell_main_unmount(
|
|||||||
{
|
{
|
||||||
char* mount_point = NULL;
|
char* mount_point = NULL;
|
||||||
int arg;
|
int arg;
|
||||||
|
|
||||||
for (arg = 1; arg < argc; arg++) {
|
for (arg = 1; arg < argc; arg++) {
|
||||||
if (!mount_point)
|
if (!mount_point)
|
||||||
mount_point = argv[arg];
|
mount_point = argv[arg];
|
||||||
@@ -48,19 +48,19 @@ int rtems_shell_main_unmount(
|
|||||||
fprintf (stderr, "error: no mount point\n");
|
fprintf (stderr, "error: no mount point\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unmount the disk.
|
* Unmount the disk.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (unmount (mount_point) < 0) {
|
if (unmount (mount_point) < 0) {
|
||||||
fprintf (stderr, "error: unmount failed: %s: %s\n",
|
fprintf (stderr, "error: unmount failed: %s: %s\n",
|
||||||
mount_point, strerror (errno));
|
mount_point, strerror (errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("unmounted %s\n", mount_point);
|
printf ("unmounted %s\n", mount_point);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ int rtems_shell_main_unsetenv(int argc, char *argv[])
|
|||||||
printf ("error: %s\n", strerror (errno));
|
printf ("error: %s\n", strerror (errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ printstream(rtems_shell_ls_globals* globals, DISPLAY *dp)
|
|||||||
if (f_size) {
|
if (f_size) {
|
||||||
if (f_humanize)
|
if (f_humanize)
|
||||||
extwidth += dp->s_size + 1;
|
extwidth += dp->s_size + 1;
|
||||||
else
|
else
|
||||||
extwidth += dp->s_block + 1;
|
extwidth += dp->s_block + 1;
|
||||||
}
|
}
|
||||||
if (f_type)
|
if (f_type)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
* Help list the topics
|
* Help list the topics
|
||||||
* help [topic] list the commands for the topic
|
* help [topic] list the commands for the topic
|
||||||
* help [command] help for the command
|
* help [command] help for the command
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtems_shell_cmd_t * rtems_shell_first_cmd;
|
rtems_shell_cmd_t * rtems_shell_first_cmd;
|
||||||
@@ -111,7 +111,7 @@ rtems_shell_cmd_t *rtems_shell_add_cmd_struct(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
rtems_shell_cmd_t *shell_pvt;
|
rtems_shell_cmd_t *shell_pvt;
|
||||||
|
|
||||||
shell_pvt = rtems_shell_first_cmd;
|
shell_pvt = rtems_shell_first_cmd;
|
||||||
while (shell_pvt) {
|
while (shell_pvt) {
|
||||||
if (strcmp(shell_pvt->name, shell_cmd->name) == 0)
|
if (strcmp(shell_pvt->name, shell_cmd->name) == 0)
|
||||||
@@ -126,13 +126,13 @@ rtems_shell_cmd_t *rtems_shell_add_cmd_struct(
|
|||||||
while (shell_pvt->next)
|
while (shell_pvt->next)
|
||||||
shell_pvt = shell_pvt->next;
|
shell_pvt = shell_pvt->next;
|
||||||
shell_pvt->next = shell_cmd;
|
shell_pvt->next = shell_cmd;
|
||||||
}
|
}
|
||||||
rtems_shell_add_topic( shell_cmd->topic );
|
rtems_shell_add_topic( shell_cmd->topic );
|
||||||
return shell_cmd;
|
return shell_cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a command as a set of arguments to the set and
|
* Add a command as a set of arguments to the set and
|
||||||
* allocate the command structure on the fly.
|
* allocate the command structure on the fly.
|
||||||
*/
|
*/
|
||||||
rtems_shell_cmd_t * rtems_shell_add_cmd(
|
rtems_shell_cmd_t * rtems_shell_add_cmd(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Dynamically build the shell prompt
|
* Dynamically build the shell prompt
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* The license and distribution terms for this file may be
|
||||||
* found in the file LICENSE in this distribution or at
|
* found in the file LICENSE in this distribution or at
|
||||||
@@ -38,7 +38,7 @@ void rtems_shell_get_prompt(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
char curdir[256];
|
char curdir[256];
|
||||||
|
|
||||||
/* XXX: show_prompt user adjustable */
|
/* XXX: show_prompt user adjustable */
|
||||||
getcwd(curdir,sizeof(curdir));
|
getcwd(curdir,sizeof(curdir));
|
||||||
snprintf(prompt, size - 1, "%s%s[%s] %c ",
|
snprintf(prompt, size - 1, "%s%s[%s] %c ",
|
||||||
|
|||||||
@@ -19,15 +19,15 @@
|
|||||||
|
|
||||||
int rtems_shell_make_args(
|
int rtems_shell_make_args(
|
||||||
char *commandLine,
|
char *commandLine,
|
||||||
int *argc_p,
|
int *argc_p,
|
||||||
char **argv_p,
|
char **argv_p,
|
||||||
int max_args
|
int max_args
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int argc;
|
int argc;
|
||||||
char *command;
|
char *command;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
argc = 0;
|
argc = 0;
|
||||||
command = commandLine;
|
command = commandLine;
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ static int findOnPATH(
|
|||||||
strcat( scriptFile, "/" );
|
strcat( scriptFile, "/" );
|
||||||
strcat(
|
strcat(
|
||||||
scriptFile,
|
scriptFile,
|
||||||
( (userScriptName[0] == '.' && userScriptName[1] == '/') ?
|
( (userScriptName[0] == '.' && userScriptName[1] == '/') ?
|
||||||
&userScriptName[2] : userScriptName)
|
&userScriptName[2] : userScriptName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ static int findOnPATH(
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/*
|
/*
|
||||||
* Does the command (argv[0]) contain a path ?, i.e. starts with
|
* Does the command (argv[0]) contain a path ?, i.e. starts with
|
||||||
* '.' or contains a '/'?
|
* '.' or contains a '/'?
|
||||||
*/
|
*/
|
||||||
@@ -120,7 +120,7 @@ int rtems_shell_main_joel(
|
|||||||
char scriptFile[PATH_MAX];
|
char scriptFile[PATH_MAX];
|
||||||
struct getopt_data getopt_reent;
|
struct getopt_data getopt_reent;
|
||||||
|
|
||||||
memset(&getopt_reent, 0, sizeof(getopt_data));
|
memset(&getopt_reent, 0, sizeof(getopt_data));
|
||||||
while ( (option = getopt_r( argc, argv, "o:p:s:t:v", &getopt_reent)) != -1 ) {
|
while ( (option = getopt_r( argc, argv, "o:p:s:t:v", &getopt_reent)) != -1 ) {
|
||||||
switch ((char)option) {
|
switch ((char)option) {
|
||||||
case 'o':
|
case 'o':
|
||||||
@@ -149,10 +149,10 @@ int rtems_shell_main_joel(
|
|||||||
case 't':
|
case 't':
|
||||||
taskName = getopt_reent.optarg;
|
taskName = getopt_reent.optarg;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
default:
|
default:
|
||||||
rtems_shell_joel_usage();
|
rtems_shell_joel_usage();
|
||||||
return -1;
|
return -1;
|
||||||
@@ -160,7 +160,7 @@ int rtems_shell_main_joel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( verbose ) {
|
if ( verbose ) {
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
"outputFile: %s\n"
|
"outputFile: %s\n"
|
||||||
"taskPriority: %" PRId32 "\n"
|
"taskPriority: %" PRId32 "\n"
|
||||||
"stackSize: %" PRId32 "\n"
|
"stackSize: %" PRId32 "\n"
|
||||||
@@ -179,10 +179,10 @@ int rtems_shell_main_joel(
|
|||||||
if ( getopt_reent.optind >= argc ) {
|
if ( getopt_reent.optind >= argc ) {
|
||||||
fprintf( stderr, "Shell: No script to execute\n" );
|
fprintf( stderr, "Shell: No script to execute\n" );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find script on the path.
|
* Find script on the path.
|
||||||
*
|
*
|
||||||
* NOTE: It is terrible that this is done twice but it
|
* NOTE: It is terrible that this is done twice but it
|
||||||
* seems to be the most expedient thing.
|
* seems to be the most expedient thing.
|
||||||
@@ -217,7 +217,7 @@ int rtems_shell_main_joel(
|
|||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtems_shell_cmd_t rtems_shell_JOEL_Command = {
|
rtems_shell_cmd_t rtems_shell_JOEL_Command = {
|
||||||
"joel", /* name */
|
"joel", /* name */
|
||||||
"joel [args] SCRIPT", /* usage */
|
"joel [args] SCRIPT", /* usage */
|
||||||
@@ -303,7 +303,7 @@ int rtems_shell_script_file(
|
|||||||
scriptHead[length - 1] = '\0';
|
scriptHead[length - 1] = '\0';
|
||||||
|
|
||||||
/* fprintf( stderr, "FIRST LINE: -%s-\n", scriptHead ); */
|
/* fprintf( stderr, "FIRST LINE: -%s-\n", scriptHead ); */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify the name of the "shell" is joel. This means
|
* Verify the name of the "shell" is joel. This means
|
||||||
* the line starts with "#! joel".
|
* the line starts with "#! joel".
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ copy_file(rtems_shell_cp_globals* cp_globals __attribute__((unused)), FTSENT *en
|
|||||||
(void)free(buf);
|
(void)free(buf);
|
||||||
return (0);
|
return (0);
|
||||||
} else if (iflag) {
|
} else if (iflag) {
|
||||||
(void)fprintf(stderr, "overwrite %s? %s",
|
(void)fprintf(stderr, "overwrite %s? %s",
|
||||||
to.p_path, YESNO);
|
to.p_path, YESNO);
|
||||||
checkch = ch = getchar();
|
checkch = ch = getchar();
|
||||||
while (ch != '\n' && ch != EOF)
|
while (ch != '\n' && ch != EOF)
|
||||||
@@ -147,9 +147,9 @@ copy_file(rtems_shell_cp_globals* cp_globals __attribute__((unused)), FTSENT *en
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fflag) {
|
if (fflag) {
|
||||||
/* remove existing destination file name,
|
/* remove existing destination file name,
|
||||||
* create a new file */
|
* create a new file */
|
||||||
(void)unlink(to.p_path);
|
(void)unlink(to.p_path);
|
||||||
if (!lflag)
|
if (!lflag)
|
||||||
@@ -255,7 +255,7 @@ copy_file(rtems_shell_cp_globals* cp_globals __attribute__((unused)), FTSENT *en
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)close(from_fd);
|
(void)close(from_fd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't remove the target even after an error. The target might
|
* Don't remove the target even after an error. The target might
|
||||||
* not be a regular file, or its attributes might be important,
|
* not be a regular file, or its attributes might be important,
|
||||||
@@ -401,7 +401,7 @@ setfile(rtems_shell_cp_globals* cp_globals, struct stat *fs, int fd)
|
|||||||
rval = 1;
|
rval = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (rval);
|
return (rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ void Stack_check_Initialize( void )
|
|||||||
p[2] = 0xDEADF00D; /* DEAD FOOD GOOD DOG */
|
p[2] = 0xDEADF00D; /* DEAD FOOD GOOD DOG */
|
||||||
p[3] = 0x600D0D06;
|
p[3] = 0x600D0D06;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If appropriate, setup the interrupt stack for high water testing
|
* If appropriate, setup the interrupt stack for high water testing
|
||||||
* also.
|
* also.
|
||||||
@@ -441,7 +441,7 @@ void Stack_check_Dump_threads_usage(
|
|||||||
} else {
|
} else {
|
||||||
(*print_handler)( print_context, "%8" PRId32 "\n", used );
|
(*print_handler)( print_context, "%8" PRId32 "\n", used );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,7 +474,7 @@ void rtems_stack_checker_report_usage_with_plugin(
|
|||||||
print_handler = print;
|
print_handler = print;
|
||||||
|
|
||||||
(*print)( context, "Stack usage by thread\n");
|
(*print)( context, "Stack usage by thread\n");
|
||||||
(*print)( context,
|
(*print)( context,
|
||||||
" ID NAME LOW HIGH CURRENT AVAILABLE USED\n"
|
" ID NAME LOW HIGH CURRENT AVAILABLE USED\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ try_again:
|
|||||||
|
|
||||||
if (state_fd > 0) {
|
if (state_fd > 0) {
|
||||||
rewind(state_f);
|
rewind(state_f);
|
||||||
len = fprintf(state_f,
|
len = fprintf(state_f,
|
||||||
"clock: %04x tv: %016lu %08lu adj: %08d\n",
|
"clock: %04x tv: %016lu %08lu adj: %08d\n",
|
||||||
clock_seq, last.tv_sec, last.tv_usec, adjustment);
|
clock_seq, last.tv_sec, last.tv_usec, adjustment);
|
||||||
fflush(state_f);
|
fflush(state_f);
|
||||||
|
|||||||
Reference in New Issue
Block a user