get rid of C++ style comments

make C99 clean
This commit is contained in:
Oliver Lehmann 2012-06-07 01:03:17 +00:00
parent f898e0fdb8
commit 8a06a46355
9 changed files with 86 additions and 86 deletions

View File

@ -117,7 +117,7 @@ OUTPUT_FILE_DEP:= ./makedep.mk
./%.o: .././%.c
@echo Building file: $<
@echo Invoking: AVR/GNU C Compiler : (AVR_8_bit_GNU_Toolchain_3.4.0_663) 4.6.2
$(QUOTE)C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-gcc.exe$(QUOTE) -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fpack-struct -fshort-enums -Wall -Wundef -Werror -pedantic -pedantic-errors -c -std=gnu99 -save-temps -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -mmcu=atmega1284p -o"$@" "$<"
$(QUOTE)C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.0.65\AVRToolchain\bin\avr-gcc.exe$(QUOTE) -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fpack-struct -fshort-enums -Wall -Wundef -Werror -pedantic -pedantic-errors -c -std=c99 -save-temps -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -mmcu=atmega1284p -o"$@" "$<"
@echo Finished building: $<

View File

@ -4,7 +4,7 @@ MCU= -mmcu=atmega1284p
CC=avr-gcc
CFLAGS= -I/usr/local/avr/include -funsigned-char -funsigned-bitfields -O1 \
-ffunction-sections -fpack-struct -fshort-enums -Wall -Wundef \
-Werror -pedantic -pedantic-errors -c -std=gnu99 ${MCU}
-Werror -pedantic -pedantic-errors -c -std=c99 ${MCU}
LDFLAGS=-Wl,-Map="${OUTPUT_FILE}.map" -Wl,--start-group -Wl,-lm \
-Wl,--end-group -Wl,--gc-sections -mrelax ${MCU}

View File

@ -59,6 +59,7 @@
<avrgcc.compiler.warnings.WarningsAsErrors>True</avrgcc.compiler.warnings.WarningsAsErrors>
<avrgcc.compiler.warnings.Pedantic>True</avrgcc.compiler.warnings.Pedantic>
<avrgcc.compiler.warnings.PedanticWarningsAsErrors>True</avrgcc.compiler.warnings.PedanticWarningsAsErrors>
<avrgcc.compiler.miscellaneous.OtherFlags>-std=c99</avrgcc.compiler.miscellaneous.OtherFlags>
<avrgcc.compiler.miscellaneous.DoNotDeleteTemporaryFiles>True</avrgcc.compiler.miscellaneous.DoNotDeleteTemporaryFiles>
<avrgcc.linker.libraries.Libraries>
<ListValues>

View File

@ -1,7 +1,7 @@
/*
* P8000 WDC Emulator
*
* $Id: wdc_config.h,v 1.5 2012/06/05 18:21:48 olivleh1 Exp $
* $Id: wdc_config.h,v 1.6 2012/06/07 01:03:17 olivleh1 Exp $
*
*/
@ -39,13 +39,16 @@
#define PIN_MMC PINB
#define DDR_MMC DDRB
#define PIN_MMC_CS PINB4 //AVR Port where the MMC Card /CS signal is connected to
#define PIN_MMC_MOSI PINB5 //AVR Port: MOSI / MMC Card: Data-In
#define PIN_MMC_MISO PINB6 //AVR Port: MISO / MMC Card: Data-Out
#define PIN_MMC_SCK PINB7 //AVR Port: SCk / MMC Card: CLK
#define PIN_MMC_CS PINB4 /* AVR Port where the MMC Card /CS signal is connected to */
#define PIN_MMC_MOSI PINB5 /* AVR Port: MOSI / MMC Card: Data-In */
#define PIN_MMC_MISO PINB6 /* AVR Port: MISO / MMC Card: Data-Out */
#define PIN_MMC_SCK PINB7 /* AVR Port: SCk / MMC Card: CLK */
//maximum performance with both turned off
//#define MMC_PRESET_MULTIBLOCKCOUNT 1
//#define SPI_CRC 1
/*
* maximum performance with both turned off
*
* #define MMC_PRESET_MULTIBLOCKCOUNT 1
* #define SPI_CRC 1
*/
#endif /* CONFIG_H_ */

View File

@ -1,7 +1,7 @@
/*
* P8000 WDC Emulator
*
* $Id: wdc_drv_mmc.c,v 1.7 2012/06/07 00:34:36 olivleh1 Exp $
* $Id: wdc_drv_mmc.c,v 1.8 2012/06/07 01:03:17 olivleh1 Exp $
*
*/
@ -140,7 +140,7 @@ uint8_t mmc_enable_crc ( uint8_t on_off )
{
unsigned char cmd[] = {CMD59, 0x00, 0x00, 0x00, 0x00, 0xFF};
//last bit enables or disables CRC mode
/* last bit enables or disables CRC mode */
cmd[4] = on_off & 0x01;
if ( mmc_cmd ( cmd ) != 0 ) {
@ -165,7 +165,7 @@ uint8_t mmc_init ()
nop();
};
SPCR = ( 1 << SPE ) | ( 1 << MSTR ) | ( 1 << SPR0 ) | ( 1 << SPR1 ); //Enable SPI, SPI in Master Mode
SPCR = ( 1 << SPE ) | ( 1 << MSTR ) | ( 1 << SPR0 ) | ( 1 << SPR1 ); /* Enable SPI, SPI in Master Mode */
SPSR = ( 0 << SPI2X );
for ( uint8_t b = 0; b < 0x0f; b++ ) {
@ -196,7 +196,7 @@ uint8_t mmc_init ()
}
}
//SPI Bus to max. speed
/* SPI Bus to max. speed */
SPCR &= ~ ( ( 1 << SPR0 ) | ( 1 << SPR1 ) );
SPSR = SPSR | ( 1 << SPI2X );
@ -214,12 +214,12 @@ uint8_t mmc_cmd ( uint8_t *cmd )
uint8_t i = 10;
uint8_t cmd0 = cmd[0];
#ifdef SPI_CRC
//Calculate CRC and framing bits
/* Calculate CRC and framing bits */
cmd[0] = ( cmd[0] | ( 1 << 6 ) ) & 0x7F;
cmd[5] = crc7 ( cmd, 5 ) << 1;
#endif
// send command
/* send command */
for ( uint8_t a = 0; a < 0x06; a++ ) {
xmit_byte ( *cmd++ );
wait_till_send_done();
@ -234,7 +234,7 @@ uint8_t mmc_cmd ( uint8_t *cmd )
return ( tmp );
}
uint8_t mmc_write_sector ( uint32_t addr, uint8_t *Buffer )
uint8_t mmc_write_sector ( uint32_t addr, uint8_t *buffer )
{
sint32 x;
uint8_t tmp;
@ -247,7 +247,7 @@ uint8_t mmc_write_sector ( uint32_t addr, uint8_t *Buffer )
MMC_Enable();
// convert blocks to bytes
/* convert blocks to bytes */
addr = addr * MMC_BLOCKLEN;
x.value32 = addr;
cmd[1] = x.value8.hh;
@ -263,25 +263,25 @@ uint8_t mmc_write_sector ( uint32_t addr, uint8_t *Buffer )
return ( tmp );
}
//send Startbyte
/* send Startbyte */
xmit_byte ( SB_START );
#ifdef SPI_CRC
crc = crc16 ( Buffer, MMC_BLOCKLEN );
crc = crc16 ( buffer, MMC_BLOCKLEN );
crch = crc >> 8;
crcl = crc & 0xff;
#endif
//write a single block
/* write a single block */
for ( i = MMC_BLOCKLEN ; i ; i-- ) {
uint8_t data = *Buffer;
Buffer++;
uint8_t data = *buffer;
buffer++;
wait_till_send_done();
xmit_byte ( data );
}
wait_till_send_done();
//handle CRC
/* handle CRC */
#ifdef SPI_CRC
xmit_byte ( crch );
wait_till_send_done();
@ -292,7 +292,7 @@ uint8_t mmc_write_sector ( uint32_t addr, uint8_t *Buffer )
send_dummy_byte();
#endif
//check for errors
/* check for errors */
send_dummy_byte();
if ( ( recv_byte() & 0x1F ) != 0x05 ) {
MMC_Disable();
@ -306,51 +306,51 @@ uint8_t mmc_write_sector ( uint32_t addr, uint8_t *Buffer )
return ( 0 );
}
uint8_t mmc_read_block ( uint8_t *cmd, uint8_t *Buffer, uint16_t Bytes )
uint8_t mmc_read_block ( uint8_t *cmd, uint8_t *buffer, uint16_t bytes )
{
uint16_t i = Bytes;
uint16_t i = bytes;
#ifdef SPI_CRC
uint16_t crc;
#endif
MMC_Enable();
//send command
/* send command */
if ( mmc_cmd ( cmd ) != 0 ) {
MMC_Disable();
return ( 1 );
}
//wait for startbyte
/* wait for startbyte */
while ( 1 ) {
send_dummy_byte();
if ( recv_byte() == SB_START )
break;
}
//read first byte
/* read first byte */
send_dummy_byte();
*Buffer = recv_byte();
*buffer = recv_byte();
//read the remaining 511 bytes
/* read the remaining 511 bytes */
do {
xmit_byte ( 0xff ); // send dummy byte
Buffer++;
xmit_byte ( 0xff ); /* send dummy byte */
buffer++;
i--;
wait_till_send_done();
*Buffer = recv_byte();
*buffer = recv_byte();
} while ( i );
Buffer = Buffer - ( Bytes - 1 );
buffer = buffer - ( bytes - 1 );
//handle CRC
/* handle CRC */
#ifdef SPI_CRC
send_dummy_byte();
crc = recv_byte() << 8;
send_dummy_byte();
crc |= recv_byte();
if ( crc != crc16 ( Buffer, Bytes ) ) {
if ( crc != crc16 ( buffer, bytes ) ) {
MMC_Disable();
return ( 1 );
}
@ -364,7 +364,7 @@ uint8_t mmc_read_block ( uint8_t *cmd, uint8_t *Buffer, uint16_t Bytes )
return ( 0 );
}
uint8_t mmc_read_sector ( uint32_t addr, uint8_t *Buffer )
uint8_t mmc_read_sector ( uint32_t addr, uint8_t *buffer )
{
sint32 x;
/*
@ -372,23 +372,18 @@ uint8_t mmc_read_sector ( uint32_t addr, uint8_t *Buffer )
*/
uint8_t cmd[] = {CMD17, 0x00, 0x00, 0x00, 0x00, 0xFF};
// convert blocks to bytes
/* convert blocks to bytes */
addr = addr * MMC_BLOCKLEN;
x.value32 = addr;
cmd[1] = x.value8.hh;
cmd[2] = x.value8.hl;
cmd[3] = x.value8.lh;
/*
cmd[1] = ( ( addr & 0xFF000000 ) >> 24 );
cmd[2] = ( ( addr & 0x00FF0000 ) >> 16 );
cmd[3] = ( ( addr & 0x0000FF00 ) >> 8 );
*/
return mmc_read_block ( cmd, Buffer, MMC_BLOCKLEN );
return mmc_read_block ( cmd, buffer, MMC_BLOCKLEN );
}
uint8_t mmc_read_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks )
uint8_t mmc_read_multiblock ( uint32_t addr, uint8_t *buffer, uint8_t numblocks )
{
sint32 x;
uint8_t resp;
@ -420,7 +415,7 @@ uint8_t mmc_read_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks
wait_till_card_ready();
#endif
// convert blocks to bytes
/* convert blocks to bytes */
addr = addr * MMC_BLOCKLEN;
x.value32 = addr;
cmd[0] = CMD18;
@ -443,7 +438,7 @@ uint8_t mmc_read_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks
do {
n--;
i = MMC_BLOCKLEN - 1;
// wait for startbyte
/* wait for startbyte */
while ( 1 ) {
send_dummy_byte();
if ( recv_byte() == SB_START )
@ -451,31 +446,31 @@ uint8_t mmc_read_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks
}
send_dummy_byte();
*Buffer = recv_byte();
// receive the block
*buffer = recv_byte();
/* receive the block */
do {
xmit_byte ( 0xff );
Buffer++;
buffer++;
i--;
wait_till_send_done();
*Buffer = recv_byte();
*buffer = recv_byte();
} while ( i );
// handle CRC
/* handle CRC */
#ifdef SPI_CRC
Buffer = Buffer - ( MMC_BLOCKLEN - 1 );
buffer = buffer - ( MMC_BLOCKLEN - 1 );
send_dummy_byte();
crc = recv_byte() << 8;
send_dummy_byte();
crc |= recv_byte();
if ( crc != crc16 ( Buffer, MMC_BLOCKLEN ) ) {
if ( crc != crc16 ( buffer, MMC_BLOCKLEN ) ) {
MMC_Disable();
return ( 1 );
}
Buffer = Buffer + MMC_BLOCKLEN;
buffer = buffer + MMC_BLOCKLEN;
#else
send_dummy_byte();
send_dummy_byte();
Buffer++;
buffer++;
#endif
} while ( n );
@ -496,7 +491,7 @@ uint8_t mmc_read_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks
return ( 2 );
}
*/
// Pad 8
/* Pad 8 */
send_dummy_byte();
MMC_Disable()
@ -504,7 +499,7 @@ uint8_t mmc_read_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks
return ( 0 );
}
uint8_t mmc_write_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks )
uint8_t mmc_write_multiblock ( uint32_t addr, uint8_t *buffer, uint8_t numblocks )
{
sint32 x;
uint8_t resp;
@ -537,7 +532,7 @@ uint8_t mmc_write_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks
wait_till_card_ready();
#endif
// convert blocks to bytes
/* convert blocks to bytes */
addr = addr * MMC_BLOCKLEN;
x.value32 = addr;
cmd[0] = CMD25;
@ -557,25 +552,25 @@ uint8_t mmc_write_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks
do {
#ifdef SPI_CRC
crc = crc16 ( Buffer, MMC_BLOCKLEN );
crc = crc16 ( buffer, MMC_BLOCKLEN );
crch = crc >> 8;
crcl = crc & 0xff;
#endif
wait_till_card_ready();
// Send multi-block start-token
/* Send multi-block start-token */
xmit_byte ( MB_START );
//actually transfer the data
/* actually transfer the data */
for ( i = MMC_BLOCKLEN; i; i-- ) {
uint8_t data = *Buffer;
Buffer++;
uint8_t data = *buffer;
buffer++;
wait_till_send_done();
xmit_byte ( data );
}
n--;
wait_till_send_done();
// handle CRC
/* handle CRC */
#ifdef SPI_CRC
xmit_byte ( crch );
wait_till_send_done();
@ -587,13 +582,13 @@ uint8_t mmc_write_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks
#endif
#ifdef MMC_PRESET_MULTIBLOCKCOUNT
// Pad 8
/* Pad 8 */
send_dummy_byte();
#else
wait_till_send_done();
#endif
// Get response
/* Get response */
send_dummy_byte();
resp = recv_byte();
if ( ( resp & 0x0E ) != 4 ) {
@ -604,11 +599,11 @@ uint8_t mmc_write_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks
wait_till_card_ready();
// Send "transfer stop byte"
/* Send "transfer stop byte" */
xmit_byte ( MB_STOP );
wait_till_send_done();
// Pad 8
/* Pad 8 */
send_dummy_byte();
wait_till_card_ready();

View File

@ -1,7 +1,7 @@
/*
* P8000 WDC Emulator
*
* $Id: wdc_drv_mmc.h,v 1.5 2012/06/07 00:34:36 olivleh1 Exp $
* $Id: wdc_drv_mmc.h,v 1.6 2012/06/07 01:03:17 olivleh1 Exp $
*
*/
@ -10,11 +10,11 @@
extern uint8_t mmc_init ();
extern uint8_t mmc_read_sector ( uint32_t addr, uint8_t *Buffer );
extern uint8_t mmc_write_sector ( uint32_t addr, uint8_t *Buffer );
extern uint8_t mmc_read_sector ( uint32_t addr, uint8_t *buffer );
extern uint8_t mmc_write_sector ( uint32_t addr, uint8_t *buffer );
extern uint8_t mmc_read_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks );
extern uint8_t mmc_write_multiblock ( uint32_t addr, uint8_t *Buffer, uint8_t numblocks );
extern uint8_t mmc_read_multiblock ( uint32_t addr, uint8_t *buffer, uint8_t numblocks );
extern uint8_t mmc_write_multiblock ( uint32_t addr, uint8_t *buffer, uint8_t numblocks );
#define MMC_BLOCKLEN 512

View File

@ -1,7 +1,7 @@
/*
* P8000 WDC Emulator
*
* $Id: wdc_if_disk.c,v 1.6 2012/06/06 22:05:06 olivleh1 Exp $
* $Id: wdc_if_disk.c,v 1.7 2012/06/07 01:03:17 olivleh1 Exp $
*
*/
@ -83,7 +83,6 @@ uint8_t wdc_write_multiblock ( uint32_t addr, uint8_t *sector, uint8_t numblocks
uint8_t errorcode;
errorcode = mmc_write_multiblock ( addr, sector, numblocks );
// errorcode = mmc_write_multiblock_predef ( addr, sector, numblocks );
if ( errorcode ) {
uart_puts_p ( PSTR ( " write error at address: " ) );
uart_putdw_dec ( addr );

View File

@ -1,7 +1,7 @@
/*
* P8000 WDC Emulator
*
* $Id: wdc_if_p8000.c,v 1.3 2012/06/05 20:30:09 olivleh1 Exp $
* $Id: wdc_if_p8000.c,v 1.4 2012/06/07 01:03:17 olivleh1 Exp $
*
*/
@ -10,6 +10,8 @@
#include <util/delay.h>
#include "wdc_if_pio.h"
#define nop() __asm__ __volatile__ ("nop" ::)
void wdc_init_ports()
{
configure_pin_status0();
@ -77,8 +79,8 @@ void wdc_write_data_to_p8k ( uint8_t *buffer, uint16_t count, uint8_t wdc_status
} while ( datacnt < count );
while ( isset_info_wdardy() );
port_info_set ( INFO_TR | INFO_ASTB | wdc_status );
asm ( "nop" );
asm ( "nop" );
nop();
nop();
port_info_set ( INFO_TR | wdc_status );
configure_port_data_read();
while ( !isset_info_wdardy() );

View File

@ -1,7 +1,7 @@
/*
* P8000 WDC Emulator
*
* $Id: wdc_main.c,v 1.15 2012/06/07 00:34:36 olivleh1 Exp $
* $Id: wdc_main.c,v 1.16 2012/06/07 01:03:17 olivleh1 Exp $
*
* TODO: - Different Errorcodes in the MMC layer (use defines)
* - errorchecking in several places
@ -238,9 +238,9 @@ main ( void )
if ( wdc_add_btt_entry ( cmd_buffer[2] | ( cmd_buffer[3] << 8 ), cmd_buffer[4] ) ) {
wdc_send_error();
} else {
data_buffer[0] = cmd_buffer[2]; // Track Low
data_buffer[1] = cmd_buffer[3]; // Track High
data_buffer[2] = cmd_buffer[4]; // Head
data_buffer[0] = cmd_buffer[2]; /* Track Low */
data_buffer[1] = cmd_buffer[3]; /* Track High */
data_buffer[2] = cmd_buffer[4]; /* Head */
wdc_send_data ( data_buffer
, 3
@ -353,7 +353,7 @@ void measure_performance()
#define BLOCKNO 300000
sei();
TIMSK0 |= ( 0x01 << TOIE0 );
TCCR0B = ( 1 << CS01 ); // Prescaler 8
TCCR0B = ( 1 << CS01 ); /* Prescaler 8 */
TCNT0 = 0x00;
uart_puts_p ( PSTR ( "Performance Measurement. Displayed are the Timer-Overflows." ) );