Subversion Repositories svn.mios32

Rev

Rev 1298 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1298 Rev 1653
Line 1... Line 1...
1
// $Id: midio_file.c 1298 2011-08-16 22:41:29Z tk $
1
// $Id: midio_file.c 1653 2013-01-09 23:08:59Z tk $
2
/*
2
/*
3
 * File access functions for MIDIO128
3
 * File access functions for MIDIO128
4
 *
4
 *
5
 * NOTE: before accessing the SD Card, the upper level function should
5
 * NOTE: before accessing the SD Card, the upper level function should
6
 * synchronize with the SD Card semaphore!
6
 * synchronize with the SD Card semaphore!
Line 22... Line 22...
22
22
23
#include <mios32.h>
23
#include <mios32.h>
24
#include <string.h>
24
#include <string.h>
25
25
26
#include "file.h"
26
#include "file.h"
-
 
27
#include "tasks.h"
27
#include "midio_file.h"
28
#include "midio_file.h"
28
#include "midio_file_p.h"
29
#include "midio_file_p.h"
29
30
30
31
31
/////////////////////////////////////////////////////////////////////////////
32
/////////////////////////////////////////////////////////////////////////////
Line 88... Line 89...
88
s32 MIDIO_FILE_UnloadAllFiles(void)
89
s32 MIDIO_FILE_UnloadAllFiles(void)
89
{
90
{
90
  s32 status = 0;
91
  s32 status = 0;
91
  status |= MIDIO_FILE_P_Unload();
92
  status |= MIDIO_FILE_P_Unload();
92
  return status;
93
  return status;
-
 
94
}
-
 
95
-
 
96
-
 
97
/////////////////////////////////////////////////////////////////////////////
-
 
98
// creates the default files if they don't exist on SD Card
-
 
99
/////////////////////////////////////////////////////////////////////////////
-
 
100
s32 MIDIO_FILE_CreateDefaultFiles(void)
-
 
101
{
-
 
102
  s32 status;
-
 
103
-
 
104
  portENTER_CRITICAL();
-
 
105
-
 
106
  // check if patch file exists
-
 
107
  if( !MIDIO_FILE_P_Valid() ) {
-
 
108
    // create new one
-
 
109
    DEBUG_MSG("Creating initial DEFAULT.MIO file\n");
-
 
110
-
 
111
    if( (status=MIDIO_FILE_P_Write("DEFAULT")) < 0 ) {
-
 
112
      DEBUG_MSG("Failed to create file! (status: %d)\n", status);
-
 
113
    }
-
 
114
  }
-
 
115
-
 
116
  portEXIT_CRITICAL();
-
 
117
-
 
118
  return 0; // no error
93
}
119
}
94
120
95
121
96
/////////////////////////////////////////////////////////////////////////////
122
/////////////////////////////////////////////////////////////////////////////
97
// sets the SD Card status
123
// sets the SD Card status