From 6fda59fe9b6c6e6f2df1ac18053b937586265e1b Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Wed, 31 Mar 2004 05:08:13 +0000 Subject: 2004-03-31 Ralf Corsepius * clock/ckinit.c, clock/rtc.c, console/inch.c, ide/ide.c, include/bsp.h, startup/bspstart.c, timer/timer.c: Convert to using c99 fixed size types. --- c/src/lib/libbsp/i386/pc386/ChangeLog | 6 ++++ c/src/lib/libbsp/i386/pc386/clock/ckinit.c | 12 +++---- c/src/lib/libbsp/i386/pc386/clock/rtc.c | 26 +++++++------- c/src/lib/libbsp/i386/pc386/console/inch.c | 6 ++-- c/src/lib/libbsp/i386/pc386/ide/ide.c | 50 +++++++++++++------------- c/src/lib/libbsp/i386/pc386/include/bsp.h | 4 +-- c/src/lib/libbsp/i386/pc386/startup/bspstart.c | 18 +++++----- c/src/lib/libbsp/i386/pc386/timer/timer.c | 16 ++++----- 8 files changed, 72 insertions(+), 66 deletions(-) (limited to 'c') diff --git a/c/src/lib/libbsp/i386/pc386/ChangeLog b/c/src/lib/libbsp/i386/pc386/ChangeLog index 2f4e24d876..87b5d83488 100644 --- a/c/src/lib/libbsp/i386/pc386/ChangeLog +++ b/c/src/lib/libbsp/i386/pc386/ChangeLog @@ -1,3 +1,9 @@ +2004-03-31 Ralf Corsepius + + * clock/ckinit.c, clock/rtc.c, console/inch.c, ide/ide.c, + include/bsp.h, startup/bspstart.c, timer/timer.c: Convert to using + c99 fixed size types. + 2004-02-19 Ralf Corsepius * Makefile.am: Don't install *.rels. Reflect changes to bsp.am. diff --git a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c index cba18a77f6..9fa7acbd33 100644 --- a/c/src/lib/libbsp/i386/pc386/clock/ckinit.c +++ b/c/src/lib/libbsp/i386/pc386/clock/ckinit.c @@ -50,9 +50,9 @@ | Global Variables +--------------------------------------------------------------------------*/ -volatile rtems_unsigned32 Clock_driver_ticks; /* Tick (interrupt) counter. */ - rtems_unsigned32 Clock_isrs_per_tick; /* ISRs per tick. */ - rtems_unsigned32 Clock_isrs; /* ISRs until next tick. */ +volatile uint32_t Clock_driver_ticks; /* Tick (interrupt) counter. */ + uint32_t Clock_isrs_per_tick; /* ISRs per tick. */ + uint32_t Clock_isrs; /* ISRs until next tick. */ /* The following variables are set by the clock driver during its init */ @@ -119,7 +119,7 @@ void clockOff(const rtems_irq_connect_data* unused) +--------------------------------------------------------------------------*/ static void clockOn(const rtems_irq_connect_data* unused) { - rtems_unsigned32 microseconds_per_isr; + uint32_t microseconds_per_isr; #if 0 /* Initialize clock from on-board real time clock. This breaks the */ @@ -157,7 +157,7 @@ static void clockOn(const rtems_irq_connect_data* unused) { /* 105/88 approximates TIMER_TICK * 1e-6 */ - rtems_unsigned32 count = US_TO_TICK(microseconds_per_isr); + uint32_t count = US_TO_TICK(microseconds_per_isr); outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN); outport_byte(TIMER_CNTR0, count >> 0 & 0xff); @@ -260,7 +260,7 @@ volatile long long Last_RDTSC; long long Kernel_Time_ns( void ) { - extern rtems_unsigned32 _TOD_Ticks_per_second; + extern uint32_t _TOD_Ticks_per_second; unsigned isrs_per_second = Clock_isrs_per_tick * _TOD_Ticks_per_second; long long now; diff --git a/c/src/lib/libbsp/i386/pc386/clock/rtc.c b/c/src/lib/libbsp/i386/pc386/clock/rtc.c index fbeac20a33..c20d308564 100644 --- a/c/src/lib/libbsp/i386/pc386/clock/rtc.c +++ b/c/src/lib/libbsp/i386/pc386/clock/rtc.c @@ -81,8 +81,8 @@ | Arguments: i - Number to convert. | Returns: BCD representation of number. +--------------------------------------------------------------------------*/ -static inline rtems_unsigned8 -bcd(rtems_unsigned8 i) +static inline uint8_t +bcd(uint8_t i) { return ((i / 16) * 10 + (i % 16)); } /* bcd */ @@ -101,8 +101,8 @@ bcd(rtems_unsigned8 i) | Arguments: y - year to convert (1970 <= y <= 2100). | Returns: number of seconds since 1970. +--------------------------------------------------------------------------*/ -static inline rtems_unsigned32 -ytos(rtems_unsigned16 y) +static inline uint32_t +ytos(uint16_t y) { /* v NUM LEAP YEARS v */ return ((y - 1970) * SECS_PER_REG_YEAR + (y - 1970 + 1) / 4 * SECS_PER_DAY); } /* ytos */ @@ -115,10 +115,10 @@ ytos(rtems_unsigned16 y) | Arguments: m - month to convert, leap - is this a month of a leap year. | Returns: number of seconds since January. +--------------------------------------------------------------------------*/ -static inline rtems_unsigned32 -mtos(rtems_unsigned8 m, rtems_boolean leap) +static inline uint32_t +mtos(uint8_t m, rtems_boolean leap) { - static rtems_unsigned16 daysMonth[] = { 0, 0, 31, 59, 90, 120, 151, 181, + static uint16_t daysMonth[] = { 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; /* Days since beginning of year until beginning of month. */ @@ -134,10 +134,10 @@ mtos(rtems_unsigned8 m, rtems_boolean leap) | Arguments: what - what to write to RTC port (what to do). | Returns: result received from RTC port after action performed. +--------------------------------------------------------------------------*/ -static inline rtems_unsigned8 -rtcin(rtems_unsigned8 what) +static inline uint8_t +rtcin(uint8_t what) { - rtems_unsigned8 r; + uint8_t r; outport_byte(IO_RTC, what); inport_byte (IO_RTC+1, r); @@ -158,7 +158,7 @@ rtcin(rtems_unsigned8 what) void init_rtc(void) { - rtems_unsigned8 s; + uint8_t s; /* initialize brain-dead battery powered clock */ outport_byte(IO_RTC, RTC_STATUSA); @@ -186,8 +186,8 @@ init_rtc(void) long int rtc_read(rtems_time_of_day *tod) { - rtems_unsigned8 sa; - rtems_unsigned32 sec = 0; + uint8_t sa; + uint32_t sec = 0; memset(tod, 0, sizeof *tod); /* zero tod structure */ diff --git a/c/src/lib/libbsp/i386/pc386/console/inch.c b/c/src/lib/libbsp/i386/pc386/console/inch.c index 5945da9a3b..d728ab3a2e 100644 --- a/c/src/lib/libbsp/i386/pc386/console/inch.c +++ b/c/src/lib/libbsp/i386/pc386/console/inch.c @@ -68,9 +68,9 @@ static char shift_map[] = static unsigned short kbd_buffer[KBD_BUF_SIZE]; -static rtems_unsigned16 kbd_first = 0; -static rtems_unsigned16 kbd_last = 0; -static rtems_unsigned16 kbd_end = KBD_BUF_SIZE - 1; +static uint16_t kbd_first = 0; +static uint16_t kbd_last = 0; +static uint16_t kbd_end = KBD_BUF_SIZE - 1; /*-------------------------------------------------------------------------+ | Function: rtemsReboot diff --git a/c/src/lib/libbsp/i386/pc386/ide/ide.c b/c/src/lib/libbsp/i386/pc386/ide/ide.c index f58eb81fce..e537287d54 100644 --- a/c/src/lib/libbsp/i386/pc386/ide/ide.c +++ b/c/src/lib/libbsp/i386/pc386/ide/ide.c @@ -92,15 +92,15 @@ void pc386_ide_read_reg \*-------------------------------------------------------------------------*/ int minor, /* controller minor number */ int reg, /* register index to access */ - unsigned16 *value /* ptr to return value location */ + uint16_t *value /* ptr to return value location */ ) /*-------------------------------------------------------------------------*\ | Return Value: | | | \*=========================================================================*/ { - unsigned32 port = IDE_Controller_Table[minor].port1; - unsigned8 bval1,bval2; + uint32_t port = IDE_Controller_Table[minor].port1; + uint8_t bval1,bval2; if (reg == IDE_REGISTER_DATA_WORD) { inport_byte(port+reg, bval1); @@ -129,14 +129,14 @@ void pc386_ide_write_reg \*-------------------------------------------------------------------------*/ int minor, /* controller minor number */ int reg, /* register index to access */ - unsigned16 value /* value to write */ + uint16_t value /* value to write */ ) /*-------------------------------------------------------------------------*\ | Return Value: | | | \*=========================================================================*/ { - unsigned32 port = IDE_Controller_Table[minor].port1; + uint32_t port = IDE_Controller_Table[minor].port1; #ifdef DEBUG_OUT printk("pc386_ide_write_reg(0x%x,0x%x)\r\n",reg,value & 0xff); @@ -161,22 +161,22 @@ void pc386_ide_read_block | Input Parameters: | \*-------------------------------------------------------------------------*/ int minor, - unsigned16 block_size, + uint16_t block_size, blkdev_sg_buffer *bufs, - rtems_unsigned32 *cbuf, - rtems_unsigned32 *pos + uint32_t *cbuf, + uint32_t *pos ) /*-------------------------------------------------------------------------*\ | Return Value: | | | \*=========================================================================*/ { - unsigned32 port = IDE_Controller_Table[minor].port1; - unsigned16 cnt = 0; - unsigned32 llength = bufs[(*cbuf)].length; - unsigned8 status_val; - unsigned16 *lbuf = (unsigned16 *) - ((unsigned8 *)(bufs[(*cbuf)].buffer) + (*pos)); + uint32_t port = IDE_Controller_Table[minor].port1; + uint16_t cnt = 0; + uint32_t llength = bufs[(*cbuf)].length; + uint8_t status_val; + uint16_t *lbuf = (uint16_t*) + ((uint8_t*)(bufs[(*cbuf)].buffer) + (*pos)); inport_byte(port+IDE_REGISTER_STATUS,status_val); while ((status_val & IDE_REGISTER_STATUS_DRQ) && @@ -214,22 +214,22 @@ void pc386_ide_write_block | Input Parameters: | \*-------------------------------------------------------------------------*/ int minor, - unsigned16 block_size, + uint16_t block_size, blkdev_sg_buffer *bufs, - rtems_unsigned32 *cbuf, - rtems_unsigned32 *pos + uint32_t *cbuf, + uint32_t *pos ) /*-------------------------------------------------------------------------*\ | Return Value: | | | \*=========================================================================*/ { - unsigned32 port = IDE_Controller_Table[minor].port1; - unsigned16 cnt = 0; - unsigned32 llength = bufs[(*cbuf)].length; - unsigned8 status_val; - unsigned16 *lbuf = (unsigned16 *) - ((unsigned8 *)(bufs[(*cbuf)].buffer) + (*pos)); + uint32_t port = IDE_Controller_Table[minor].port1; + uint16_t cnt = 0; + uint32_t llength = bufs[(*cbuf)].length; + uint8_t status_val; + uint16_t *lbuf = (uint16_t*) + ((uint8_t*)(bufs[(*cbuf)].buffer) + (*pos)); #ifdef DEBUG_OUT printk("pc386_ide_write_block()\r\n"); @@ -266,7 +266,7 @@ int pc386_ide_control | Input Parameters: | \*-------------------------------------------------------------------------*/ int minor, /* controller minor number */ - unsigned32 cmd, /* command to send */ + uint32_t cmd, /* command to send */ void * arg /* optional argument */ ) /*-------------------------------------------------------------------------*\ @@ -289,7 +289,7 @@ rtems_status_code pc386_ide_config_io_speed | Input Parameters: | \*-------------------------------------------------------------------------*/ int minor, /* controller minor number */ - unsigned8 modes_avail /* optional argument */ + uint8_t modes_avail /* optional argument */ ) /*-------------------------------------------------------------------------*\ | Return Value: | diff --git a/c/src/lib/libbsp/i386/pc386/include/bsp.h b/c/src/lib/libbsp/i386/pc386/include/bsp.h index 0ae6c3b5e4..b4defc186b 100644 --- a/c/src/lib/libbsp/i386/pc386/include/bsp.h +++ b/c/src/lib/libbsp/i386/pc386/include/bsp.h @@ -173,7 +173,7 @@ extern int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int); +--------------------------------------------------------------------------*/ #define rtems_bsp_delay(_microseconds) \ { \ - rtems_unsigned32 _cnt = _microseconds; \ + uint32_t _cnt = _microseconds; \ asm volatile ("0: nop; mov %0,%0; loop 0b" : "=c"(_cnt) : "0"(_cnt)); \ } #endif @@ -195,7 +195,7 @@ extern segment_descriptors Global_descriptor_table [GDT_SIZE]; extern rtems_configuration_table BSP_Configuration; /* User provided BSP configuration table. */ -extern rtems_unsigned32 rtemsFreeMemStart; +extern uint32_t rtemsFreeMemStart; /* Address of start of free memory - should be used when creating new partitions or regions and updated afterwards. */ diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c index 50d70e9295..3535f2b735 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c @@ -39,17 +39,17 @@ /*-------------------------------------------------------------------------+ | Global Variables +--------------------------------------------------------------------------*/ -extern rtems_unsigned32 _end; /* End of BSS. Defined in 'linkcmds'. */ +extern uint32_t _end; /* End of BSS. Defined in 'linkcmds'. */ /* * Size of heap if it is 0 it will be dynamically defined by memory size, * otherwise the value should be changed by binary patch */ -rtems_unsigned32 _heap_size = 0; +uint32_t _heap_size = 0; /* Size of stack used during initialization. Defined in 'start.s'. */ -extern rtems_unsigned32 _stack_size; +extern uint32_t _stack_size; -rtems_unsigned32 rtemsFreeMemStart; +uint32_t rtemsFreeMemStart; /* Address of start of free memory - should be updated after creating new partitions or regions. */ @@ -66,7 +66,7 @@ char *rtems_progname; /* Program name - from main(). */ | External Prototypes +--------------------------------------------------------------------------*/ extern void rtems_irq_mngt_init(void); -void bsp_libc_init( void *, unsigned32, int ); +void bsp_libc_init( void *, uint32_t, int ); void bsp_postdriver_hook(void); /*-------------------------------------------------------------------------+ @@ -81,7 +81,7 @@ void bsp_postdriver_hook(void); +--------------------------------------------------------------------------*/ void bsp_pretasking_hook(void) { - rtems_unsigned32 topAddr, val; + uint32_t topAddr, val; int i; @@ -98,13 +98,13 @@ void bsp_pretasking_hook(void) for(i=2048; i>=2; i--) { topAddr = i*1024*1024 - 4; - *(volatile rtems_unsigned32 *)topAddr = topAddr; + *(volatile uint32_t*)topAddr = topAddr; } for(i=2; i<=2048; i++) { topAddr = i*1024*1024 - 4; - val = *(rtems_unsigned32 *)topAddr; + val = *(uint32_t*)topAddr; if(val != topAddr) { break; @@ -144,7 +144,7 @@ void bsp_start_default( void ) */ Calibrate_loop_1ms(); - rtemsFreeMemStart = (rtems_unsigned32)&_end + _stack_size; + rtemsFreeMemStart = (uint32_t)&_end + _stack_size; /* set the value of start of free memory. */ /* If we don't have command line arguments set default program name. */ diff --git a/c/src/lib/libbsp/i386/pc386/timer/timer.c b/c/src/lib/libbsp/i386/pc386/timer/timer.c index 0e0f1d9003..82d7b1401d 100644 --- a/c/src/lib/libbsp/i386/pc386/timer/timer.c +++ b/c/src/lib/libbsp/i386/pc386/timer/timer.c @@ -51,7 +51,7 @@ #define LEAST_VALID 1 /* Don't trust a value lower than this. */ #define SLOW_DOWN_IO 0x80 /* io which does nothing */ -#define TWO_MS (rtems_unsigned32)(2000) /* TWO_MS = 2000us (sic!) */ +#define TWO_MS (uint32_t)(2000) /* TWO_MS = 2000us (sic!) */ #define MSK_NULL_COUNT 0x40 /* bit counter available for reading */ @@ -59,7 +59,7 @@ /*-------------------------------------------------------------------------+ | Global Variables +--------------------------------------------------------------------------*/ -volatile rtems_unsigned32 Ttimer_val; +volatile uint32_t Ttimer_val; rtems_boolean Timer_driver_Find_average_overhead = TRUE; volatile unsigned int fastLoop1ms, slowLoop1ms; @@ -134,12 +134,12 @@ Timer_initialize(void) | Arguments: None. | Returns: Nothing. +--------------------------------------------------------------------------*/ -rtems_unsigned32 +uint32_t Read_timer(void) { - register rtems_unsigned32 total; + register uint32_t total; - total = (rtems_unsigned32)(rdtsc() - Ttimer_val); + total = (uint32_t)(rdtsc() - Ttimer_val); if (Timer_driver_Find_average_overhead) return total; @@ -256,11 +256,11 @@ Timer_initialize(void) | Arguments: None. | Returns: Nothing. +--------------------------------------------------------------------------*/ -rtems_unsigned32 +uint32_t Read_timer(void) { - register rtems_unsigned32 total, clicks; - register rtems_unsigned8 lsb, msb; + register uint32_t total, clicks; + register uint8_t lsb, msb; outport_byte(TIMER_MODE, TIMER_SEL0|TIMER_LATCH); inport_byte(TIMER_CNTR0, lsb); -- cgit v1.2.3