Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
CC32xxHelper.cxx
Go to the documentation of this file.
1
34#define SUPPORT_SL_R1_API
35
37
38#include "utils/logging.h"
39#include "utils/macros.h"
40#include "simplelink.h"
41#include "fs.h"
42
43volatile int g_last_sl_result;
44
45void SlCheckResult(int result, int expected)
46{
47 g_last_sl_result = result;
48 HASSERT(result == expected);
49}
50
51void SlCheckError(int result)
52{
53 g_last_sl_result = result;
54 HASSERT(result >= 0);
55}
56
57int SlDeleteFile(const void* filename)
58{
59 const uint8_t* name = (const uint8_t*)filename;
60 int ret = sl_FsDel(name, 0);
61 if (ret == SL_ERROR_FS_FILE_HAS_NOT_BEEN_CLOSE_CORRECTLY)
62 {
63 ret = sl_FsOpen( name, SL_FS_WRITE, nullptr);
64 LOG(INFO, "recreate %s: %d", name, ret);
65 if (ret >= 0)
66 {
67 ret = sl_FsClose(ret, nullptr, nullptr, 0);
68 LOG(INFO, "recreate-close %s: %d", name, ret);
69 }
70 ret = sl_FsDel(name, 0);
71 LOG(INFO, "redelete %s: %d", name, ret);
72 }
73 return ret;
74}
int SlDeleteFile(const void *filename)
Deletes a file from sflash.
void SlCheckResult(int result, int expected)
Tests that a SimpleLink request has succeeded.
void SlCheckError(int result)
Tests that a SimpleLink request has succeeded (return >= 0).
#define LOG(level, message...)
Conditionally write a message to the logging output.
Definition logging.h:99
static const int INFO
Loglevel that is printed by default, reporting some status information.
Definition logging.h:57
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.
Definition macros.h:138