corrected bug in ata.c to avoid lockup of libblock

added remote frequest support to gen5200 BSP
This commit is contained in:
Thomas Doerfler
2006-12-18 09:46:59 +00:00
parent d761931ed0
commit 36cb812bbc
13 changed files with 204 additions and 395 deletions

View File

@@ -1,3 +1,8 @@
2006-12-18 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
* libchip/ide/ata.c: in ata_request_done: moved call to free()
from preemption disabled region
2006-12-13 Joel Sherrill <joel@OARcorp.com> 2006-12-13 Joel Sherrill <joel@OARcorp.com>
PR 1181/bsps PR 1181/bsps

View File

@@ -1,3 +1,11 @@
2006-12-18 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
* gen5200/mscan/mscan.c,
* gen5200/mscan/mscan.h,
* gen5200/mscan/mscan_int.h:
split mscan.h into two headers, corrected CAN filtering code to
support remote requests
2006-12-13 Till Straumann <strauman@slac.stanford.edu> 2006-12-13 Till Straumann <strauman@slac.stanford.edu>
* mvme5500/Makefile.am, mvme5500/preinstall.am: * mvme5500/Makefile.am, mvme5500/preinstall.am:

View File

@@ -84,7 +84,7 @@ irq_rel_CPPFLAGS = $(AM_CPPFLAGS)
irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) irq_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
noinst_PROGRAMS += mscan.rel noinst_PROGRAMS += mscan.rel
mscan_rel_SOURCES = mscan/mscan.c mscan/mscan.h mscan_rel_SOURCES = mscan/mscan.c mscan/mscan.h mscan/mscan_int.h
mscan_rel_CPPFLAGS = $(AM_CPPFLAGS) mscan_rel_CPPFLAGS = $(AM_CPPFLAGS)
mscan_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) mscan_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)

View File

@@ -91,6 +91,8 @@
#define MIN(a,b) (((a)<(b))?(a):(b)) #define MIN(a,b) (((a)<(b))?(a):(b))
#endif #endif
#define IDE_DMA_TEST FALSE #define IDE_DMA_TEST FALSE
#ifdef BRS5L
#define IDE_USE_INT TRUE #define IDE_USE_INT TRUE
#define IDE_READ_USE_DMA TRUE #define IDE_READ_USE_DMA TRUE
#define IDE_USE_READ_PIO_OPT FALSE #define IDE_USE_READ_PIO_OPT FALSE
@@ -98,6 +100,16 @@
#define IDE_USE_WRITE_PIO_OPT TRUE #define IDE_USE_WRITE_PIO_OPT TRUE
/* #define IDE_USE_DMA (IDE_READ_USE_DMA||IDE_WRITE_USE_DMA) */ /* #define IDE_USE_DMA (IDE_READ_USE_DMA||IDE_WRITE_USE_DMA) */
#define IDE_USE_DMA TRUE #define IDE_USE_DMA TRUE
#else
#define IDE_USE_INT TRUE
#define IDE_READ_USE_DMA FALSE
#define IDE_USE_READ_PIO_OPT FALSE
#define IDE_WRITE_USE_DMA FALSE
#define IDE_USE_WRITE_PIO_OPT FALSE
/* #define IDE_USE_DMA (IDE_READ_USE_DMA||IDE_WRITE_USE_DMA) */
#define IDE_USE_DMA FALSE
#endif
#define IDE_USE_STATISTICS TRUE #define IDE_USE_STATISTICS TRUE
#if IDE_USE_DMA #if IDE_USE_DMA

View File

@@ -26,12 +26,10 @@
#include "../include/bsp.h" #include "../include/bsp.h"
#include "../irq/irq.h" #include "../irq/irq.h"
#include "../include/mpc5200.h" #include "../include/mpc5200.h"
#include "mscan.h" #include "../mscan/mscan_int.h"
/* #define MSCAN_LOOPBACK */ /* #define MSCAN_LOOPBACK */
volatile uint32_t tx_int_wr_count = 0;
struct mpc5200_rx_cntrl mpc5200_mscan_rx_cntrl[MPC5200_CAN_NO]; struct mpc5200_rx_cntrl mpc5200_mscan_rx_cntrl[MPC5200_CAN_NO];
static struct mscan_channel_info chan_info[MPC5200_CAN_NO]; static struct mscan_channel_info chan_info[MPC5200_CAN_NO];
@@ -176,46 +174,42 @@ static void mpc5200_mscan_interrupt_handler(rtems_irq_hdl_param handle)
mscan->txidr2 = 0; mscan->txidr2 = 0;
mscan->txidr3 = 0; mscan->txidr3 = 0;
/* insert dlc into mscan register */
mscan->txdlr = (uint8_t)((tx_mess_ptr->mess_len) & 0x000F);
} }
/* select one free tx buffer if TOUCAN not registered) */ /* fill in tx data if TOUCAN is activ an TOUCAN index have a match with the tx buffer or TOUCAN is disabled */
if(((mscan_hdl->toucan_callback) == NULL) || (((mscan_hdl->toucan_callback) != NULL) && ((tx_mess_ptr->toucan_tx_id) == idx))) if(((mscan_hdl->toucan_callback) == NULL) || (((mscan_hdl->toucan_callback) != NULL) && ((tx_mess_ptr->toucan_tx_idx) == idx)))
{ {
/* set tx id */
mscan->txidr0 = SET_IDR0(tx_mess_ptr->mess_id);
mscan->txidr1 = SET_IDR1(tx_mess_ptr->mess_id);
mscan->txidr2 = 0;
mscan->txidr3 = 0;
/* insert dlc into mscan register */ /* insert dlc into mscan register */
mscan->txdlr = (uint8_t)((tx_mess_ptr->mess_len) & 0x000F); mscan->txdlr = (uint8_t)((tx_mess_ptr->mess_len) & 0x000F);
/* copy tx data to MSCAN registers */ /* skip data copy in case of RTR */
switch(mscan->txdlr) if(!(MSCAN_MESS_ID_HAS_RTR(tx_mess_ptr->mess_id)))
{ {
case 8: /* copy tx data to MSCAN registers */
mscan->txdsr7 = tx_mess_ptr->mess_data[7]; switch(mscan->txdlr)
case 7: {
mscan->txdsr6 = tx_mess_ptr->mess_data[6]; case 8:
case 6: mscan->txdsr7 = tx_mess_ptr->mess_data[7];
mscan->txdsr5 = tx_mess_ptr->mess_data[5]; case 7:
case 5: mscan->txdsr6 = tx_mess_ptr->mess_data[6];
mscan->txdsr4 = tx_mess_ptr->mess_data[4]; case 6:
case 4: mscan->txdsr5 = tx_mess_ptr->mess_data[5];
mscan->txdsr3 = tx_mess_ptr->mess_data[3]; case 5:
case 3: mscan->txdsr4 = tx_mess_ptr->mess_data[4];
mscan->txdsr2 = tx_mess_ptr->mess_data[2]; case 4:
case 2: mscan->txdsr3 = tx_mess_ptr->mess_data[3];
mscan->txdsr1 = tx_mess_ptr->mess_data[1]; case 3:
case 1: mscan->txdsr2 = tx_mess_ptr->mess_data[2];
mscan->txdsr0 = tx_mess_ptr->mess_data[0]; case 2:
break; mscan->txdsr1 = tx_mess_ptr->mess_data[1];
default: case 1:
break; mscan->txdsr0 = tx_mess_ptr->mess_data[0];
} break;
default:
break;
}
}
/* enable message buffer specific interrupt */ /* enable message buffer specific interrupt */
mscan->tier |= mscan->bsel; mscan->tier |= mscan->bsel;
@@ -226,8 +220,6 @@ static void mpc5200_mscan_interrupt_handler(rtems_irq_hdl_param handle)
/* release counting semaphore of tx ring buffer */ /* release counting semaphore of tx ring buffer */
rtems_semaphore_release((rtems_id)(chan->tx_rb_sid)); rtems_semaphore_release((rtems_id)(chan->tx_rb_sid));
tx_int_wr_count++;
} }
else else
{ {
@@ -301,30 +293,34 @@ static void mpc5200_mscan_interrupt_handler(rtems_irq_hdl_param handle)
/* get time stamp */ /* get time stamp */
rx_mess_ptr->mess_time_stamp = ((mscan->rxtimh << 8) | (mscan->rxtiml)); rx_mess_ptr->mess_time_stamp = ((mscan->rxtimh << 8) | (mscan->rxtiml));
/* get the data */ /* skip data copy in case of RTR */
switch(rx_mess_ptr->mess_len) if(!(MSCAN_MESS_ID_HAS_RTR(rx_mess_ptr->mess_id)))
{
case 8: {
rx_mess_ptr->mess_data[7] = mscan->rxdsr7;
case 7:
rx_mess_ptr->mess_data[6] = mscan->rxdsr6;
case 6:
rx_mess_ptr->mess_data[5] = mscan->rxdsr5;
case 5:
rx_mess_ptr->mess_data[4] = mscan->rxdsr4;
case 4:
rx_mess_ptr->mess_data[3] = mscan->rxdsr3;
case 3:
rx_mess_ptr->mess_data[2] = mscan->rxdsr2;
case 2:
rx_mess_ptr->mess_data[1] = mscan->rxdsr1;
case 1:
rx_mess_ptr->mess_data[0] = mscan->rxdsr0;
case 0:
default:
break;
/* get the data */
switch(rx_mess_ptr->mess_len)
{
case 8:
rx_mess_ptr->mess_data[7] = mscan->rxdsr7;
case 7:
rx_mess_ptr->mess_data[6] = mscan->rxdsr6;
case 6:
rx_mess_ptr->mess_data[5] = mscan->rxdsr5;
case 5:
rx_mess_ptr->mess_data[4] = mscan->rxdsr4;
case 4:
rx_mess_ptr->mess_data[3] = mscan->rxdsr3;
case 3:
rx_mess_ptr->mess_data[2] = mscan->rxdsr2;
case 2:
rx_mess_ptr->mess_data[1] = mscan->rxdsr1;
case 1:
rx_mess_ptr->mess_data[0] = mscan->rxdsr0;
case 0:
default:
break;
}
} }
if(mscan_hdl->toucan_callback == NULL) if(mscan_hdl->toucan_callback == NULL)
@@ -871,15 +867,15 @@ void mpc5200_mscan_perform_init_mode_settings(volatile struct mpc5200_mscan *msc
mscan->idac &= ~(IDAC_IDAM1); mscan->idac &= ~(IDAC_IDAM1);
mscan->idac |= (IDAC_IDAM0); mscan->idac |= (IDAC_IDAM0);
/* initialize rx filter masks (16 bit) */ /* initialize rx filter masks (16 bit), don't care including rtr */
mscan->idmr0 = SET_IDMR0(0x07FF); mscan->idmr0 = SET_IDMR0(0x7FF);
mscan->idmr1 = SET_IDMR1(0x07FF); mscan->idmr1 = SET_IDMR1(0x7FF);
mscan->idmr2 = SET_IDMR2(0x07FF); mscan->idmr2 = SET_IDMR2(0x7FF);
mscan->idmr3 = SET_IDMR3(0x07FF); mscan->idmr3 = SET_IDMR3(0x7FF);
mscan->idmr4 = SET_IDMR4(0x07FF); mscan->idmr4 = SET_IDMR4(0x7FF);
mscan->idmr5 = SET_IDMR5(0x07FF); mscan->idmr5 = SET_IDMR5(0x7FF);
mscan->idmr6 = SET_IDMR6(0x07FF); mscan->idmr6 = SET_IDMR6(0x7FF);
mscan->idmr7 = SET_IDMR7(0x07FF); mscan->idmr7 = SET_IDMR7(0x7FF);
/* Control Register 1 --------------------------------------------*/ /* Control Register 1 --------------------------------------------*/
/* [07]:CANE 0->1 : MSCAN Module is enabled */ /* [07]:CANE 0->1 : MSCAN Module is enabled */
@@ -1301,7 +1297,7 @@ rtems_device_driver mscan_write( rtems_device_major_number major,
{ {
/* append the TOUCAN tx_id to the mess. due to interrupt handling */ /* append the TOUCAN tx_id to the mess. due to interrupt handling */
tx_mess->toucan_tx_id = tx_parms->tx_id; tx_mess->toucan_tx_idx = tx_parms->tx_idx;
/* fill the tx ring buffer with the message */ /* fill the tx ring buffer with the message */
fill_tx_buffer(chan, tx_mess); fill_tx_buffer(chan, tx_mess);
@@ -1486,19 +1482,19 @@ rtems_device_driver mscan_control( rtems_device_major_number major,
{ {
case RX_BUFFER_0: case RX_BUFFER_0:
ctrl_parms->ctrl_id_mask = GET_IDMR0(mscan->idmr0) | GET_IDMR1(mscan->idmr1); ctrl_parms->ctrl_id_mask = (GET_IDMR0(mscan->idmr0) | GET_IDMR1(mscan->idmr1));
break; break;
case RX_BUFFER_1: case RX_BUFFER_1:
ctrl_parms->ctrl_id_mask = GET_IDMR2(mscan->idmr2) | GET_IDMR3(mscan->idmr3); ctrl_parms->ctrl_id_mask = (GET_IDMR2(mscan->idmr2) | GET_IDMR3(mscan->idmr3));
break; break;
case RX_BUFFER_2: case RX_BUFFER_2:
ctrl_parms->ctrl_id_mask = GET_IDMR4(mscan->idmr4) | GET_IDMR5(mscan->idmr5); ctrl_parms->ctrl_id_mask = (GET_IDMR4(mscan->idmr4) | GET_IDMR5(mscan->idmr5));
break; break;
case RX_BUFFER_3: case RX_BUFFER_3:
ctrl_parms->ctrl_id_mask = GET_IDMR6(mscan->idmr6) | GET_IDMR7(mscan->idmr7); ctrl_parms->ctrl_id_mask = (GET_IDMR6(mscan->idmr6) | GET_IDMR7(mscan->idmr7));
break; break;
default: default:

View File

@@ -17,7 +17,7 @@
| http://www.rtems.com/license/LICENSE. | | http://www.rtems.com/license/LICENSE. |
| | | |
+-----------------------------------------------------------------+ +-----------------------------------------------------------------+
| this file declares stuff for the mscan driver | | this file has to be included by application when using mscan |
\*===============================================================*/ \*===============================================================*/
#ifndef __MSCAN_H__ #ifndef __MSCAN_H__
#define __MSCAN_H__ #define __MSCAN_H__
@@ -26,17 +26,6 @@
extern "C" { extern "C" {
#endif #endif
#define MIN_NO_OF_TQ 7
#define NO_OF_TABLE_ENTRIES 4
#define TSEG_1 1
#define TSEG_2 2
#define SJW 3
#define MSCAN_MAX_DATA_BYTES 8
#define MSCAN_RX_BUFF_NUM 4
#define MSCAN_TX_BUFF_NUM 3
#define MSCAN_A_DEV_NAME "/dev/mscana" #define MSCAN_A_DEV_NAME "/dev/mscana"
#define MSCAN_B_DEV_NAME "/dev/mscanb" #define MSCAN_B_DEV_NAME "/dev/mscanb"
#define MSCAN_0_DEV_NAME "/dev/mscan0" #define MSCAN_0_DEV_NAME "/dev/mscan0"
@@ -44,20 +33,12 @@ extern "C" {
#define MSCAN_A 0 #define MSCAN_A 0
#define MSCAN_B 1 #define MSCAN_B 1
#define MSCAN_NON_INITIALIZED_MODE 0 #define MSCAN_MAX_DATA_BYTES 8
#define MSCAN_INITIALIZED_MODE 1
#define MSCAN_INIT_NORMAL_MODE 2
#define MSCAN_NORMAL_MODE 4
#define MSCAN_SLEEP_MODE 8
#define CAN_BIT_RATE_MAX 1000000 #define MSCAN_MESS_ID_RTR (1 << 15)
#define CAN_BIT_RATE_MIN 100000 #define MSCAN_MESS_ID_RTR_MASK (1 << 15)
#define MSCAN_MESS_ID_ID_MASK ((1 << 11)-1)
#define CAN_BIT_RATE 100000 #define MSCAN_MESS_ID_HAS_RTR(id) (((id)&MSCAN_MESS_ID_RTR_MASK)==MSCAN_MESS_ID_RTR)
#define CAN_MAX_NO_OF_TQ 25
#define CAN_MAX_NO_OF_TQ_TSEG1 15
#define CAN_MAX_NO_OF_TQ_TSEG2 7
#define CAN_MAX_NO_OF_TQ_SJW 2
#define MSCAN_SET_RX_ID 1 #define MSCAN_SET_RX_ID 1
#define MSCAN_GET_RX_ID 2 #define MSCAN_GET_RX_ID 2
@@ -65,187 +46,10 @@ extern "C" {
#define MSCAN_GET_RX_ID_MASK 4 #define MSCAN_GET_RX_ID_MASK 4
#define MSCAN_SET_TX_ID 5 #define MSCAN_SET_TX_ID 5
#define MSCAN_GET_TX_ID 6 #define MSCAN_GET_TX_ID 6
#define TOUCAN_MSCAN_INIT 7 #define TOUCAN_MSCAN_INIT 7
#define MSCAN_SET_BAUDRATE 8 #define MSCAN_SET_BAUDRATE 8
#define SET_TX_BUF_NO 9 #define SET_TX_BUF_NO 9
#define MSCAN_RX_BUFF_NOACTIVE (0 << 4)
#define MSCAN_RX_BUFF_EMPTY (1 << 6)
#define MSCAN_RX_BUFF_FULL (1 << 5)
#define MSCAN_RX_BUFF_OVERRUN ((MSCAN_RX_BUFF_EMPTY) | (MSCAN_RX_BUFF_FULL))
#define MSCAN_RX_BUFF_BUSY (1 << 4)
#define MSCAN_MBUFF_MASK 0x07
#define MSCAN_TX_BUFF0 (1 << 0)
#define MSCAN_TX_BUFF1 (1 << 1)
#define MSCAN_TX_BUFF2 (1 << 2)
#define MSCAN_IDE (1 << 0)
#define MSCAN_RTR (1 << 1)
#define MSCAN_READ_RXBUFF_0 (1 << 2)
#define MSCAN_READ_RXBUFF_1 (1 << 2)
#define MSCAN_READ_RXBUFF_2 (1 << 2)
#define MSCAN_READ_RXBUFF_3 (1 << 2)
#define CTL0_RXFRM (1 << 7)
#define CTL0_RXACT (1 << 6)
#define CTL0_CSWAI (1 << 5)
#define CTL0_SYNCH (1 << 4)
#define CTL0_TIME (1 << 3)
#define CTL0_WUPE (1 << 2)
#define CTL0_SLPRQ (1 << 1)
#define CTL0_INITRQ (1 << 0)
#define CTL1_CANE (1 << 7)
#define CTL1_CLKSRC (1 << 6)
#define CTL1_LOOPB (1 << 5)
#define CTL1_LISTEN (1 << 4)
#define CTL1_WUPM (1 << 2)
#define CTL1_SLPAK (1 << 1)
#define CTL1_INITAK (1 << 0)
#define BTR0_SJW(btr0) ((btr0) << 6)
#define BTR0_BRP(btr0) ((btr0) << 0)
#define BTR1_SAMP (1 << 7)
#define BTR1_TSEG_22_20(btr1) ((btr1) << 4)
#define BTR1_TSEG_13_10(btr1) ((btr1) << 0)
#define RFLG_WUPIF (1 << 7)
#define RFLG_CSCIF (1 << 6)
#define RFLG_RSTAT (3 << 4)
#define RFLG_TSTAT (3 << 2)
#define RFLG_OVRIF (1 << 1)
#define RFLG_RXF (1 << 0)
#define RFLG_GET_RX_STATE(rflg) (((rflg) >> 4) & 0x03)
#define RFLG_GET_TX_STATE(rflg) (((rflg) >> 2) & 0x03)
#define MSCAN_STATE_OK 0
#define MSCAN_STATE_ERR 1
#define MSCAN_STATE_WRN 2
#define MSCAN_STATE_BUSOFF 3
#define RIER_WUPIE (1 << 7)
#define RIER_CSCIE (1 << 6)
#define RIER_RSTAT(rier) ((rier) << 4)
#define RIER_TSTAT(rier) ((rier) << 2)
#define RIER_OVRIE (1 << 1)
#define RIER_RXFIE (1 << 0)
#define TFLG_TXE2 (1 << 2)
#define TFLG_TXE1 (1 << 1)
#define TFLG_TXE0 (1 << 0)
#define TIER_TXEI2 (1 << 2)
#define TIER_TXEI1 (1 << 1)
#define TIER_TXEI0 (1 << 0)
#define TARQ_ABTRQ2 (1 << 2)
#define TARQ_ABTRQ1 (1 << 1)
#define TARQ_ABTRQ0 (1 << 0)
#define TAAK_ABTRQ2 (1 << 2)
#define TAAK_ABTRQ1 (1 << 1)
#define TAAK_ABTRQ0 (1 << 0)
#define BSEL_TX2 (1 << 2)
#define BSEL_TX1 (1 << 1)
#define BSEL_TX0 (1 << 0)
#define IDAC_IDAM1 (1 << 5)
#define IDAC_IDAM0 (1 << 4)
#define IDAC_IDHIT(idac) ((idac) & 0x7)
#define TX_MBUF_SEL(buf_no) (1 << (buf_no))
#define TX_DATA_LEN(len) ((len) & 0x0F)
#define TX_MBUF_EMPTY(val) (1 << (val))
#define TXIDR1_IDE (1 << 3)
#define TXIDR1_SRR (1 << 4)
#define TXIDR3_RTR (1 << 0)
#define TXIDR1_RTR (1 << 4)
#define RXIDR1_IDE (1 << 3)
#define RXIDR1_SRR (1 << 4)
#define RXIDR3_RTR (1 << 0)
#define RXIDR1_RTR (1 << 4)
#define SET_IDR0(u16) ((uint8_t)((u16) >> 3))
#define SET_IDR1(u16) ((uint8_t)(((u16) & 0x0007) << 5))
#define SET_IDR2(u16) SET_IDR0(u16)
#define SET_IDR3(u16) SET_IDR1(u16)
#define SET_IDR4(u16) SET_IDR0(u16)
#define SET_IDR5(u16) SET_IDR1(u16)
#define SET_IDR6(u16) SET_IDR0(u16)
#define SET_IDR7(u16) SET_IDR1(u16)
#define GET_IDR0(u16) ((uint16_t) ((u16) << 3))
#define GET_IDR1(u16) ((uint16_t)(((u16) >> 5)&0x0007))
#define GET_IDR2(u16) GET_IDR0(u16)
#define GET_IDR3(u16) GET_IDR1(u16)
#define GET_IDR4(u16) GET_IDR0(u16)
#define GET_IDR5(u16) GET_IDR1(u16)
#define GET_IDR6(u16) GET_IDR0(u16)
#define GET_IDR7(u16) GET_IDR1(u16)
#define SET_IDMR0(u16) ((uint8_t)((u16) >> 3))
#define SET_IDMR1(u16) ((uint8_t)((((u16) & 0x0007) << 5))|0x001F)
#define SET_IDMR2(u16) SET_IDMR0(u16)
#define SET_IDMR3(u16) SET_IDMR1(u16)
#define SET_IDMR4(u16) SET_IDMR0(u16)
#define SET_IDMR5(u16) SET_IDMR1(u16)
#define SET_IDMR6(u16) SET_IDMR0(u16)
#define SET_IDMR7(u16) SET_IDMR1(u16)
#define GET_IDMR0(u16) ((uint16_t) ((u16) << 3))
#define GET_IDMR1(u16) ((uint16_t)(((u16) >> 5)&0x0007))
#define GET_IDMR2(u16) GET_IDMR0(u16)
#define GET_IDMR3(u16) GET_IDMR1(u16)
#define GET_IDMR4(u16) GET_IDMR0(u16)
#define GET_IDMR5(u16) GET_IDMR1(u16)
#define GET_IDMR6(u16) GET_IDMR0(u16)
#define GET_IDMR7(u16) GET_IDMR1(u16)
#define NO_OF_MSCAN_RX_BUFF 20
#define MSCAN_MESSAGE_SIZE(size) (((size)%CPU_ALIGNMENT) ? (((size) + CPU_ALIGNMENT)-((size) + CPU_ALIGNMENT)%CPU_ALIGNMENT) : (size))
#define TX_BUFFER_0 0
#define TX_BUFFER_1 1
#define TX_BUFFER_2 2
#define RX_BUFFER_0 0
#define RX_BUFFER_1 1
#define RX_BUFFER_2 2
#define RX_BUFFER_3 3
#define NO_OF_MSCAN_TX_BUFF 20
#define RING_BUFFER_EMPTY(rbuff) ((((rbuff)->head) == ((rbuff)->tail)) ? TRUE : FALSE)
#define RING_BUFFER_FULL(rbuff) ((((rbuff)->head) == ((rbuff)->tail)) ? TRUE : FALSE)
typedef struct _mscan_handle
{
uint8_t mscan_channel;
void (*toucan_callback)(int16_t);
} mscan_handle;
struct can_message struct can_message
{ {
/* uint16_t mess_len; */ /* uint16_t mess_len; */
@@ -253,33 +57,8 @@ struct can_message
uint16_t mess_time_stamp; uint16_t mess_time_stamp;
uint8_t mess_data[MSCAN_MAX_DATA_BYTES]; uint8_t mess_data[MSCAN_MAX_DATA_BYTES];
uint8_t mess_len; uint8_t mess_len;
uint32_t toucan_tx_id; uint8_t mess_rtr;
}; uint32_t toucan_tx_idx;
struct ring_buf
{
struct can_message * volatile buf_ptr;
struct can_message * volatile head_ptr;
struct can_message * volatile tail_ptr;
};
struct mpc5200_rx_cntrl
{
struct can_message can_rx_message[MSCAN_RX_BUFF_NUM];
};
struct mscan_channel_info
{
volatile struct mpc5200_mscan *regs;
uint32_t int_rx_err;
rtems_id rx_qid;
uint32_t rx_qname;
rtems_id tx_rb_sid;
uint32_t tx_rb_sname;
uint8_t id_extended;
uint8_t mode;
uint8_t tx_buf_no;
struct ring_buf tx_ring_buf;
}; };
struct mscan_rx_parms struct mscan_rx_parms
@@ -292,7 +71,7 @@ struct mscan_rx_parms
struct mscan_tx_parms struct mscan_tx_parms
{ {
struct can_message *tx_mess; struct can_message *tx_mess;
uint32_t tx_id; uint32_t tx_idx;
}; };
struct mscan_ctrl_parms struct mscan_ctrl_parms
@@ -306,10 +85,6 @@ struct mscan_ctrl_parms
}; };
extern void CanInterrupt_A(int16_t);
extern void CanInterrupt_B(int16_t);
rtems_device_driver mscan_initialize( rtems_device_major_number, rtems_device_driver mscan_initialize( rtems_device_major_number,
rtems_device_minor_number, rtems_device_minor_number,
void * void *
@@ -345,23 +120,6 @@ rtems_device_driver mscan_control( rtems_device_major_number,
{ mscan_initialize, mscan_open, mscan_close, \ { mscan_initialize, mscan_open, mscan_close, \
mscan_read, mscan_write, mscan_control } mscan_read, mscan_write, mscan_control }
/*MSCAN driver internal functions */
void mscan_hardware_initialize(rtems_device_major_number, uint32_t, void *);
void mpc5200_mscan_int_enable(volatile struct mpc5200_mscan *);
void mpc5200_mscan_int_disable(volatile struct mpc5200_mscan *);
void mpc5200_mscan_enter_sleep_mode(volatile struct mpc5200_mscan *);
void mpc5200_mscan_exit_sleep_mode(volatile struct mpc5200_mscan *);
void mpc5200_mscan_enter_init_mode(volatile struct mpc5200_mscan *);
void mpc5200_mscan_exit_init_mode(volatile struct mpc5200_mscan *);
void mpc5200_mscan_wait_sync(volatile struct mpc5200_mscan *);
void mpc5200_mscan_perform_init_mode_settings(volatile struct mpc5200_mscan *);
void mpc5200_mscan_perform_normal_mode_settings(volatile struct mpc5200_mscan *);
rtems_status_code mpc5200_mscan_set_mode(rtems_device_minor_number, uint8_t);
rtems_status_code mscan_channel_initialize(rtems_device_major_number, rtems_device_minor_number);
uint8_t prescaler_calculation(uint32_t, uint32_t, uint8_t *);
void mpc5200_mscan_perform_bit_time_settings(volatile struct mpc5200_mscan *, uint32_t, uint32_t);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -528,15 +528,16 @@ ata_request_done(ata_req_t *areq, rtems_device_minor_number ctrl_minor,
DISABLE_PREEMPTION(key); DISABLE_PREEMPTION(key);
ATA_EXEC_CALLBACK(areq, status, error); ATA_EXEC_CALLBACK(areq, status, error);
Chain_Extract(&areq->link); Chain_Extract(&areq->link);
free(areq);
if (!Chain_Is_empty(&ata_ide_ctrls[ctrl_minor].reqs)) if (!Chain_Is_empty(&ata_ide_ctrls[ctrl_minor].reqs))
{ {
ENABLE_PREEMPTION(key); ENABLE_PREEMPTION(key);
free(areq);
ata_process_request(ctrl_minor); ata_process_request(ctrl_minor);
return; return;
} }
ENABLE_PREEMPTION(key); ENABLE_PREEMPTION(key);
free(areq);
} }
/* ata_non_data_request_done -- /* ata_non_data_request_done --

View File

@@ -1,3 +1,10 @@
2006-12-18 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
* libblock/src/bdbuf.c:
* libblock/include/bdbuf.h:
export some internal variables to make them available in
"show_bdbuf" monitor add-on
2006-12-13 Ralf Corsépius <ralf.corsepius@rtems.org> 2006-12-13 Ralf Corsépius <ralf.corsepius@rtems.org>
* aclocal/rtems-ampolish.m4: Use am_aux_dir/ampolish3. * aclocal/rtems-ampolish.m4: Use am_aux_dir/ampolish3.
@@ -13,6 +20,7 @@
* libnetworking/rtems/rtems_glue.c: Remove local * libnetworking/rtems/rtems_glue.c: Remove local
extern strdup. extern strdup.
>>>>>>> 1.696.2.26
2006-12-08 Ralf Corsépius <ralf.corsepius@rtems.org> 2006-12-08 Ralf Corsépius <ralf.corsepius@rtems.org>
* libcsupport/include/rtems/libio.h, libcsupport/src/read.c, * libcsupport/include/rtems/libio.h, libcsupport/src/read.c,

View File

@@ -7,7 +7,8 @@ include $(top_srcdir)/automake/compile.am
if !UNIX if !UNIX
noinst_LIBRARIES = libblock.a noinst_LIBRARIES = libblock.a
libblock_a_SOURCES = src/bdbuf.c src/blkdev.c src/diskdevs.c src/ramdisk.c \ libblock_a_SOURCES = src/bdbuf.c src/blkdev.c src/diskdevs.c src/show_bdbuf.c \
src/ramdisk.c \
src/ide_part_table.c include/rtems/bdbuf.h include/rtems/blkdev.h \ src/ide_part_table.c include/rtems/bdbuf.h include/rtems/blkdev.h \
include/rtems/diskdevs.h include/rtems/ramdisk.h \ include/rtems/diskdevs.h include/rtems/ramdisk.h \
include/rtems/ide_part_table.h include/rtems/ide_part_table.h

View File

@@ -8,7 +8,7 @@
* Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
* Author: Victor V. Vengerov <vvv@oktet.ru> * Author: Victor V. Vengerov <vvv@oktet.ru>
* *
* @(#) $Id$ * @(#) bdbuf.h,v 1.9 2005/02/02 00:06:18 joel Exp
*/ */
#ifndef _RTEMS_BDBUF_H #ifndef _RTEMS_BDBUF_H
@@ -74,6 +74,48 @@ typedef struct bdbuf_buffer {
} bdbuf_buffer; } bdbuf_buffer;
/*
* the following data structures are internal to the bdbuf layer,
* but it is convenient to have them visible from the outside for inspection
*/
/*
* The groups of the blocks with the same size are collected in the
* bd_pool. Note that a several of the buffer's groups with the
* same size can exists.
*/
typedef struct bdbuf_pool
{
bdbuf_buffer *tree; /* Buffer descriptor lookup AVL tree root */
Chain_Control free; /* Free buffers list */
Chain_Control lru; /* Last recently used list */
int blksize; /* The size of the blocks (in bytes) */
int nblks; /* Number of blocks in this pool */
rtems_id bufget_sema; /* Buffer obtain counting semaphore */
void *mallocd_bufs; /* Pointer to the malloc'd buffer memory,
or NULL, if buffer memory provided in
buffer configuration */
bdbuf_buffer *bdbufs; /* Pointer to table of buffer descriptors
allocated for this buffer pool. */
} bdbuf_pool;
/* Buffering layer context definition */
struct bdbuf_context {
bdbuf_pool *pool; /* Table of buffer pools */
int npools; /* Number of entries in pool table */
Chain_Control mod; /* Modified buffers list */
rtems_id flush_sema; /* Buffer flush semaphore; counting
semaphore; incremented when buffer
flushed to the disk; decremented when
buffer modified */
rtems_id swapout_task; /* Swapout task ID */
};
/*
* the context of the buffering layer, visible for inspection
*/
extern struct bdbuf_context rtems_bdbuf_ctx;
/* bdbuf_config structure describes block configuration (size, /* bdbuf_config structure describes block configuration (size,
* amount, memory location) for buffering layer * amount, memory location) for buffering layer

View File

@@ -7,7 +7,7 @@
* Victor V. Vengerov <vvv@oktet.ru> * Victor V. Vengerov <vvv@oktet.ru>
* Alexander Kukuta <kam@oktet.ru> * Alexander Kukuta <kam@oktet.ru>
* *
* @(#) $Id$ * @(#) bdbuf.c,v 1.14 2004/04/17 08:15:17 ralf Exp
*/ */
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
@@ -55,40 +55,6 @@ typedef struct {
static rtems_task bdbuf_swapout_task(rtems_task_argument unused); static rtems_task bdbuf_swapout_task(rtems_task_argument unused);
static rtems_status_code bdbuf_release(bdbuf_buffer *bd_buf); static rtems_status_code bdbuf_release(bdbuf_buffer *bd_buf);
/*
* The groups of the blocks with the same size are collected in the
* bd_pool. Note that a several of the buffer's groups with the
* same size can exists.
*/
typedef struct bdbuf_pool
{
bdbuf_buffer *tree; /* Buffer descriptor lookup AVL tree root */
Chain_Control free; /* Free buffers list */
Chain_Control lru; /* Last recently used list */
int blksize; /* The size of the blocks (in bytes) */
int nblks; /* Number of blocks in this pool */
rtems_id bufget_sema; /* Buffer obtain counting semaphore */
void *mallocd_bufs; /* Pointer to the malloc'd buffer memory,
or NULL, if buffer memory provided in
buffer configuration */
bdbuf_buffer *bdbufs; /* Pointer to table of buffer descriptors
allocated for this buffer pool. */
} bdbuf_pool;
/* Buffering layer context definition */
struct bdbuf_context {
bdbuf_pool *pool; /* Table of buffer pools */
int npools; /* Number of entries in pool table */
Chain_Control mod; /* Modified buffers list */
rtems_id flush_sema; /* Buffer flush semaphore; counting
semaphore; incremented when buffer
flushed to the disk; decremented when
buffer modified */
rtems_id swapout_task; /* Swapout task ID */
};
/* /*
* maximum number of blocks that might be chained together to one * maximum number of blocks that might be chained together to one
* write driver call * write driver call
@@ -108,8 +74,8 @@ typedef struct blkdev_request1 {
blkdev_sg_buffer sg[1]; blkdev_sg_buffer sg[1];
} blkdev_request1; } blkdev_request1;
/* The static context of buffering layer */ /* The context of buffering layer */
static struct bdbuf_context bd_ctx; struct bdbuf_context rtems_bdbuf_ctx;
#define SAFE #define SAFE
#ifdef SAFE #ifdef SAFE
@@ -711,7 +677,7 @@ avl_remove(bdbuf_buffer **root, const bdbuf_buffer *node)
static rtems_status_code static rtems_status_code
bdbuf_initialize_pool(rtems_bdbuf_config *config, int pool) bdbuf_initialize_pool(rtems_bdbuf_config *config, int pool)
{ {
bdbuf_pool *p = bd_ctx.pool + pool; bdbuf_pool *p = rtems_bdbuf_ctx.pool + pool;
unsigned char *bufs; unsigned char *bufs;
bdbuf_buffer *b; bdbuf_buffer *b;
rtems_status_code rc; rtems_status_code rc;
@@ -787,7 +753,7 @@ bdbuf_initialize_pool(rtems_bdbuf_config *config, int pool)
static rtems_status_code static rtems_status_code
bdbuf_release_pool(rtems_bdpool_id pool) bdbuf_release_pool(rtems_bdpool_id pool)
{ {
bdbuf_pool *p = bd_ctx.pool + pool; bdbuf_pool *p = rtems_bdbuf_ctx.pool + pool;
rtems_semaphore_delete(p->bufget_sema); rtems_semaphore_delete(p->bufget_sema);
free(p->bdbufs); free(p->bdbufs);
free(p->mallocd_bufs); free(p->mallocd_bufs);
@@ -818,18 +784,18 @@ rtems_bdbuf_init(rtems_bdbuf_config *conf_table, int size)
if (size <= 0) if (size <= 0)
return RTEMS_INVALID_SIZE; return RTEMS_INVALID_SIZE;
bd_ctx.npools = size; rtems_bdbuf_ctx.npools = size;
/* /*
* Allocate memory for buffer pool descriptors * Allocate memory for buffer pool descriptors
*/ */
bd_ctx.pool = calloc(size, sizeof(bdbuf_pool)); rtems_bdbuf_ctx.pool = calloc(size, sizeof(bdbuf_pool));
if (bd_ctx.pool == NULL) if (rtems_bdbuf_ctx.pool == NULL)
{ {
return RTEMS_NO_MEMORY; return RTEMS_NO_MEMORY;
} }
Chain_Initialize_empty(&bd_ctx.mod); Chain_Initialize_empty(&rtems_bdbuf_ctx.mod);
/* Initialize buffer pools and roll out if something failed */ /* Initialize buffer pools and roll out if something failed */
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
@@ -851,12 +817,12 @@ rtems_bdbuf_init(rtems_bdbuf_config *conf_table, int size)
rtems_build_name('B', 'F', 'L', 'U'), 0, rtems_build_name('B', 'F', 'L', 'U'), 0,
RTEMS_FIFO | RTEMS_COUNTING_SEMAPHORE | RTEMS_NO_INHERIT_PRIORITY | RTEMS_FIFO | RTEMS_COUNTING_SEMAPHORE | RTEMS_NO_INHERIT_PRIORITY |
RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, 0, RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, 0,
&bd_ctx.flush_sema); &rtems_bdbuf_ctx.flush_sema);
if (rc != RTEMS_SUCCESSFUL) if (rc != RTEMS_SUCCESSFUL)
{ {
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
bdbuf_release_pool(i); bdbuf_release_pool(i);
free(bd_ctx.pool); free(rtems_bdbuf_ctx.pool);
return rc; return rc;
} }
@@ -869,24 +835,24 @@ rtems_bdbuf_init(rtems_bdbuf_config *conf_table, int size)
SWAPOUT_TASK_STACK_SIZE, SWAPOUT_TASK_STACK_SIZE,
RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
RTEMS_DEFAULT_ATTRIBUTES, RTEMS_DEFAULT_ATTRIBUTES,
&bd_ctx.swapout_task); &rtems_bdbuf_ctx.swapout_task);
if (rc != RTEMS_SUCCESSFUL) if (rc != RTEMS_SUCCESSFUL)
{ {
rtems_semaphore_delete(bd_ctx.flush_sema); rtems_semaphore_delete(rtems_bdbuf_ctx.flush_sema);
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
bdbuf_release_pool(i); bdbuf_release_pool(i);
free(bd_ctx.pool); free(rtems_bdbuf_ctx.pool);
return rc; return rc;
} }
rc = rtems_task_start(bd_ctx.swapout_task, bdbuf_swapout_task, 0); rc = rtems_task_start(rtems_bdbuf_ctx.swapout_task, bdbuf_swapout_task, 0);
if (rc != RTEMS_SUCCESSFUL) if (rc != RTEMS_SUCCESSFUL)
{ {
rtems_task_delete(bd_ctx.swapout_task); rtems_task_delete(rtems_bdbuf_ctx.swapout_task);
rtems_semaphore_delete(bd_ctx.flush_sema); rtems_semaphore_delete(rtems_bdbuf_ctx.flush_sema);
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
bdbuf_release_pool(i); bdbuf_release_pool(i);
free(bd_ctx.pool); free(rtems_bdbuf_ctx.pool);
return rc; return rc;
} }
@@ -933,7 +899,7 @@ find_or_assign_buffer(disk_device *dd,
int blksize; int blksize;
device = dd->dev; device = dd->dev;
bd_pool = bd_ctx.pool + dd->pool; bd_pool = rtems_bdbuf_ctx.pool + dd->pool;
blksize = dd->block_size; blksize = dd->block_size;
again: again:
@@ -1021,7 +987,7 @@ again:
* that our buffer descriptor is in the list. */ * that our buffer descriptor is in the list. */
if (bd_buf->modified) if (bd_buf->modified)
{ {
rc = rtems_semaphore_obtain(bd_ctx.flush_sema, rc = rtems_semaphore_obtain(rtems_bdbuf_ctx.flush_sema,
RTEMS_NO_WAIT, 0); RTEMS_NO_WAIT, 0);
} }
else else
@@ -1476,7 +1442,7 @@ bdbuf_release(bdbuf_buffer *bd_buf)
if (bd_buf->use_count <= 0) if (bd_buf->use_count <= 0)
return RTEMS_INTERNAL_ERROR; return RTEMS_INTERNAL_ERROR;
bd_pool = bd_ctx.pool + bd_buf->pool; bd_pool = rtems_bdbuf_ctx.pool + bd_buf->pool;
bd_buf->use_count--; bd_buf->use_count--;
@@ -1487,10 +1453,10 @@ bdbuf_release(bdbuf_buffer *bd_buf)
/* Buffer was modified. Insert buffer to the modified buffers /* Buffer was modified. Insert buffer to the modified buffers
* list and initiate flushing. */ * list and initiate flushing. */
Chain_Append(&bd_ctx.mod, &bd_buf->link); Chain_Append(&rtems_bdbuf_ctx.mod, &bd_buf->link);
/* Release the flush_sema */ /* Release the flush_sema */
rc = rtems_semaphore_release(bd_ctx.flush_sema); rc = rtems_semaphore_release(rtems_bdbuf_ctx.flush_sema);
} }
else else
{ {
@@ -1659,7 +1625,7 @@ rtems_bdbuf_syncdev(dev_t dev)
if (dd == NULL) if (dd == NULL)
return RTEMS_INVALID_ID; return RTEMS_INVALID_ID;
pool = bd_ctx.pool + dd->pool; pool = rtems_bdbuf_ctx.pool + dd->pool;
DISABLE_PREEMPTION(key); DISABLE_PREEMPTION(key);
do { do {
@@ -1718,13 +1684,13 @@ bdbuf_swapout_task(rtems_task_argument unused)
* otherwise do not wait, if no buffer available * otherwise do not wait, if no buffer available
*/ */
if (nxt_bd_buf == NULL) { if (nxt_bd_buf == NULL) {
rc = rtems_semaphore_obtain(bd_ctx.flush_sema, rc = rtems_semaphore_obtain(rtems_bdbuf_ctx.flush_sema,
(req.req.count == 0) (req.req.count == 0)
? RTEMS_WAIT ? RTEMS_WAIT
: RTEMS_NO_WAIT, : RTEMS_NO_WAIT,
0); 0);
if (rc == RTEMS_SUCCESSFUL) { if (rc == RTEMS_SUCCESSFUL) {
nxt_bd_buf = (bdbuf_buffer *)Chain_Get(&bd_ctx.mod); nxt_bd_buf = (bdbuf_buffer *)Chain_Get(&rtems_bdbuf_ctx.mod);
if (nxt_bd_buf != NULL) { if (nxt_bd_buf != NULL) {
nxt_bd_buf->in_progress = TRUE; nxt_bd_buf->in_progress = TRUE;
/* IMD try: clear "modified" bit early */ /* IMD try: clear "modified" bit early */
@@ -1764,7 +1730,7 @@ bdbuf_swapout_task(rtems_task_argument unused)
* for next main loop * for next main loop
*/ */
if (bd_buf != NULL) { if (bd_buf != NULL) {
bd_pool = bd_ctx.pool + bd_buf->pool; bd_pool = rtems_bdbuf_ctx.pool + bd_buf->pool;
if (req.req.count == 0) { if (req.req.count == 0) {
/* /*
* this is the first block, so use its address * this is the first block, so use its address
@@ -1818,8 +1784,8 @@ bdbuf_swapout_task(rtems_task_argument unused)
{ {
if (bd_buf->modified) if (bd_buf->modified)
{ {
Chain_Append(&bd_ctx.mod, &bd_buf->link); Chain_Append(&rtems_bdbuf_ctx.mod, &bd_buf->link);
rc = rtems_semaphore_release(bd_ctx.flush_sema); rc = rtems_semaphore_release(rtems_bdbuf_ctx.flush_sema);
} }
else else
{ {
@@ -1860,7 +1826,7 @@ rtems_bdbuf_find_pool(int block_size, rtems_bdpool_id *pool)
if (j != 1) if (j != 1)
return RTEMS_INVALID_SIZE; return RTEMS_INVALID_SIZE;
for (i = 0, p = bd_ctx.pool; i < bd_ctx.npools; i++, p++) for (i = 0, p = rtems_bdbuf_ctx.pool; i < rtems_bdbuf_ctx.npools; i++, p++)
{ {
if ((p->blksize >= block_size) && if ((p->blksize >= block_size) &&
(p->blksize < cursize)) (p->blksize < cursize))
@@ -1903,17 +1869,17 @@ rtems_status_code
rtems_bdbuf_get_pool_info(rtems_bdpool_id pool, int *block_size, rtems_bdbuf_get_pool_info(rtems_bdpool_id pool, int *block_size,
int *blocks) int *blocks)
{ {
if (pool >= bd_ctx.npools) if (pool >= rtems_bdbuf_ctx.npools)
return RTEMS_INVALID_NUMBER; return RTEMS_INVALID_NUMBER;
if (block_size != NULL) if (block_size != NULL)
{ {
*block_size = bd_ctx.pool[pool].blksize; *block_size = rtems_bdbuf_ctx.pool[pool].blksize;
} }
if (blocks != NULL) if (blocks != NULL)
{ {
*blocks = bd_ctx.pool[pool].nblks; *blocks = rtems_bdbuf_ctx.pool[pool].nblks;
} }
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;

View File

@@ -1,3 +1,7 @@
2006-12-18 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
* init.c: added stdout flushs after prompts
2006-12-02 Ralf Corsépius <ralf.corsepius@rtems.org> 2006-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: New BUG-REPORT address. * configure.ac: New BUG-REPORT address.

View File

@@ -129,6 +129,7 @@ void fileio_part_table_initialize(void)
printf(" =========================\n"); printf(" =========================\n");
fileio_print_free_heap(); fileio_print_free_heap();
printf(" Enter device to initialize ==>"); printf(" Enter device to initialize ==>");
fflush(stdout);
fgets(devname,sizeof(devname)-1,stdin); fgets(devname,sizeof(devname)-1,stdin);
while (devname[strlen(devname)-1] == '\n') { while (devname[strlen(devname)-1] == '\n') {
devname[strlen(devname)-1] = '\0'; devname[strlen(devname)-1] = '\0';
@@ -175,6 +176,7 @@ void fileio_list_file(void)
printf(" =========================\n"); printf(" =========================\n");
fileio_print_free_heap(); fileio_print_free_heap();
printf(" Enter filename to list ==>"); printf(" Enter filename to list ==>");
fflush(stdout);
fgets(fname,sizeof(fname)-1,stdin); fgets(fname,sizeof(fname)-1,stdin);
while (fname[strlen(fname)-1] == '\n') { while (fname[strlen(fname)-1] == '\n') {
fname[strlen(fname)-1] = '\0'; fname[strlen(fname)-1] = '\0';
@@ -281,6 +283,7 @@ void fileio_write_file(void)
*/ */
if (!failed) { if (!failed) {
printf("Enter path/filename ==>"); printf("Enter path/filename ==>");
fflush(stdout);
fgets(fname,sizeof(fname)-1,stdin); fgets(fname,sizeof(fname)-1,stdin);
while (fname[strlen(fname)-1] == '\n') { while (fname[strlen(fname)-1] == '\n') {
fname[strlen(fname)-1] = '\0'; fname[strlen(fname)-1] = '\0';
@@ -296,6 +299,7 @@ void fileio_write_file(void)
if (!failed) { if (!failed) {
printf("use suffix K for Kbytes, M for Mbytes or no suffix for bytes:\n" printf("use suffix K for Kbytes, M for Mbytes or no suffix for bytes:\n"
"Enter filesize to write ==>"); "Enter filesize to write ==>");
fflush(stdout);
fgets(tmp_str,sizeof(tmp_str)-1,stdin); fgets(tmp_str,sizeof(tmp_str)-1,stdin);
failed = fileio_str2size(tmp_str,&file_size); failed = fileio_str2size(tmp_str,&file_size);
if (failed) { if (failed) {
@@ -308,6 +312,7 @@ void fileio_write_file(void)
if (!failed) { if (!failed) {
printf("use suffix K for Kbytes, M for Mbytes or no suffix for bytes:\n" printf("use suffix K for Kbytes, M for Mbytes or no suffix for bytes:\n"
"Enter block size to use for write calls ==>"); "Enter block size to use for write calls ==>");
fflush(stdout);
fgets(tmp_str,sizeof(tmp_str)-1,stdin); fgets(tmp_str,sizeof(tmp_str)-1,stdin);
failed = fileio_str2size(tmp_str,&buf_size); failed = fileio_str2size(tmp_str,&buf_size);
if (failed) { if (failed) {
@@ -437,6 +442,7 @@ void fileio_read_file(void)
*/ */
if (!failed) { if (!failed) {
printf("Enter path/filename ==>"); printf("Enter path/filename ==>");
fflush(stdout);
fgets(fname,sizeof(fname)-1,stdin); fgets(fname,sizeof(fname)-1,stdin);
while (fname[strlen(fname)-1] == '\n') { while (fname[strlen(fname)-1] == '\n') {
fname[strlen(fname)-1] = '\0'; fname[strlen(fname)-1] = '\0';
@@ -452,6 +458,7 @@ void fileio_read_file(void)
if (!failed) { if (!failed) {
printf("use suffix K for Kbytes, M for Mbytes or no suffix for bytes:\n" printf("use suffix K for Kbytes, M for Mbytes or no suffix for bytes:\n"
"Enter block size to use for read calls ==>"); "Enter block size to use for read calls ==>");
fflush(stdout);
fgets(tmp_str,sizeof(tmp_str)-1,stdin); fgets(tmp_str,sizeof(tmp_str)-1,stdin);
failed = fileio_str2size(tmp_str,&buf_size); failed = fileio_str2size(tmp_str,&buf_size);
if (failed) { if (failed) {
@@ -549,6 +556,7 @@ void fileio_menu (void)
printf(" s -> start shell\n"); printf(" s -> start shell\n");
#endif #endif
printf(" Enter your selection ==>"); printf(" Enter your selection ==>");
fflush(stdout);
inbuf[0] = '\0'; inbuf[0] = '\0';
fgets(inbuf,sizeof(inbuf),stdin); fgets(inbuf,sizeof(inbuf),stdin);