Changeset - 61bd3e3de919
[Not reviewed]
default
0 1 0
mkanning@CL-SEC241-10.cedarville.edu - 12 years ago 2012-11-08 15:23:45
mkanning@CL-SEC241-10.cedarville.edu
a few updates for sd card handling
1 file changed with 13 insertions and 18 deletions:
0 comments (0 inline, 0 general)
master/master/lib/logger.c
Show inline comments
 
@@ -22,35 +22,31 @@
 
  * the configuration defines in the files fat_config.h, partition_config.h,
 
  * sd_raw_config.h and sd-reader_config.h. For example, you could disable
 
  * write support completely if you only need read support.
 

	
 
 */
 
 
void logger_setup()
 
{
 
	while(1)
 
	{
 
		//check for sd exist/power/ready
 
		/* setup sd card slot */
 
		if(!sd_raw_init()) //sd_raw.c
 
		//check for SD exist/power/ready BEGIN
 
		/* setup SD card slot */
 
		if(!sd_raw_init()) //sd_raw.c this function may need an overhaul
 
		{
 
				#if DEBUG
 
		uart_puts_p(PSTR("MMC/SD initialization failed\n"));
 
			#endif
 
	#if DEBUG
 
			uart_puts_p(PSTR("MMC/SD initialization failed\n"));
 
	#endif
 
			continue;
 
		}
 
	
 
		//check for SD exist/power/ready END
 
	
 
		//create partition BEGIN
 
		/* open first partition */ 
 
		struct partition_struct* partition = partition_open(sd_raw_read,
 
															sd_raw_read_interval,
 
	#if SD_RAW_WRITE_SUPPORT //probably want this to be true ??
 
	//#if SD_RAW_WRITE_SUPPORT //probably want this to be true ??
 
															sd_raw_write,
 
															sd_raw_write_interval,
 
	#else
 
															0,
 
															0,
 
	#endif
 
	//#endif
 
															0
 
															);
 
		//check that partition was created correctly
 
@@ -59,6 +55,7 @@ void logger_setup()
 
			/* If the partition did not open, assume the storage device
 
				* is a "superfloppy", i.e. has no MBR.
 
				*/
 
			//what is MBR ??
 
			partition = partition_open(sd_raw_read,
 
										sd_raw_read_interval,
 
	#if SD_RAW_WRITE_SUPPORT //probably want this to be true ??
 
@@ -134,7 +131,8 @@ void logger_setup()
 
			}
 

	
 
			/* read text from the shell and write it to the file */
 
			uint8_t data_len;
 
			uint8_t data_len = sizeof(buffer);
 
			
 
			while(1)
 
			{
 
				/* write text to file !! */
 
@@ -160,14 +158,13 @@ void logger_setup()
 
		/* close partition */
 
		partition_close(partition); //partition.c
 
		//prepare for closing SD connection END
 
 
	}
 
}	
 
 
//writes a single line to the SD card
 
uint8_t logger_writeLine(char* dateLine, uint8_t length)
 
{
 
	
 
	return length; //does not actually return length
 
}
 
 
//i think opens a file so it can be read/written
 
@@ -194,5 +191,3 @@ uint8_t find_file_in_dir(struct fat_fs_s
 

	
 
	return 0;
 
}
 

	
 
//i think this initializes the SD for read and write ??
 
\ No newline at end of file
0 comments (0 inline, 0 general)