mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
Merge pull request #20 from prife/simmerge
some bug fix after the recently merge from simmerge branch
This commit is contained in:
commit
ba245ae880
5 files changed
+261
-7
No files matched your search
@@ -0,0 +1,3 @@
|
||||
handle SIGUSR1 nostop noignore noprint
|
||||
handle SIGUSR2 nostop noignore noprint
|
||||
handle SIGALRM nostop noignore noprint
|
||||
@@ -185,9 +185,26 @@ rt_err_t rt_hw_sdcard_init(const char *spi_device_name)
|
||||
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <finsh.h>
|
||||
void eraseall(void)
|
||||
int sd_erase(void)
|
||||
{
|
||||
printf("had not implemented yet!\n");
|
||||
rt_uint32_t index;
|
||||
char * buffer;
|
||||
struct rt_device *device;
|
||||
device = &_sdcard.parent;
|
||||
if ((buffer = rt_malloc(SECTOR_SIZE)) == RT_NULL)
|
||||
{
|
||||
rt_kprintf("out of memory\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(buffer, 0, SECTOR_SIZE);
|
||||
/* just erase the MBR! */
|
||||
for (index = 0; index < 2; index ++)
|
||||
{
|
||||
rt_sdcard_write(device, index, buffer, SECTOR_SIZE);
|
||||
}
|
||||
rt_free(buffer);
|
||||
return 0;
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(eraseall, erase all block in SPI flash);
|
||||
FINSH_FUNCTION_EXPORT(sd_erase, erase all block in SPI flash);
|
||||
#endif
|
||||
@@ -141,6 +141,7 @@ static void sdlfb_hw_init(void)
|
||||
#include <mmsystem.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -158,8 +159,15 @@ static void *sdl_loop(void *lpParam)
|
||||
int quit = 0;
|
||||
SDL_Event event;
|
||||
int button_state = 0;
|
||||
|
||||
rt_device_t device;
|
||||
|
||||
#ifndef _WIN32
|
||||
sigset_t sigmask, oldmask;
|
||||
/* set the getchar without buffer */
|
||||
sigfillset(&sigmask);
|
||||
pthread_sigmask(SIG_BLOCK, &sigmask, &oldmask);
|
||||
#endif
|
||||
|
||||
sdlfb_hw_init();
|
||||
|
||||
device = rt_device_find("sdl");
|
||||
@@ -315,14 +323,14 @@ void rt_hw_sdl_start(void)
|
||||
}
|
||||
ResumeThread(thread);
|
||||
#else
|
||||
/* Linux */
|
||||
pthread_t pid;
|
||||
/* Linux */
|
||||
pthread_t pid;
|
||||
int res;
|
||||
res = pthread_create(&pid, NULL, &sdl_loop, NULL);
|
||||
if (res)
|
||||
{
|
||||
printf("pthread create sdl thread faild, <%d>\n", res);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -123,7 +123,12 @@ int dfs_elm_mount(struct dfs_filesystem *fs, unsigned long rwflag, const void *d
|
||||
rt_snprintf(drive, sizeof(drive), "%d:/", index);
|
||||
dir = (DIR *)rt_malloc(sizeof(DIR));
|
||||
if (dir == RT_NULL)
|
||||
{
|
||||
f_mount((BYTE)index, RT_NULL);
|
||||
disk[index] = RT_NULL;
|
||||
rt_free(fat);
|
||||
return -DFS_STATUS_ENOMEM;
|
||||
}
|
||||
|
||||
/* open the root directory to test whether the fatfs is valid */
|
||||
result = f_opendir(dir, drive);
|
||||
@@ -137,6 +142,7 @@ int dfs_elm_mount(struct dfs_filesystem *fs, unsigned long rwflag, const void *d
|
||||
}
|
||||
|
||||
__err:
|
||||
f_mount((BYTE)index, RT_NULL);
|
||||
disk[index] = RT_NULL;
|
||||
rt_free(fat);
|
||||
return elm_result_to_dfs(result);
|
||||
|
||||
Reference in new issue
Block a user