提交kernel部分的文件,本批次的文件只进行了依赖关系、注释、宏几个方面的调整,不涉及任何逻辑代码层面的改动

This commit is contained in:
a92126 2024-08-01 17:42:50 +08:00
parent 455bdf188c
commit 98b2c783e9
13 changed files with 39 additions and 23 deletions

View File

@ -46,4 +46,4 @@ KRes switchContext(KRes res, uintptr_t *oldSp, uintptr_t newSp);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include "types.h"
#include "internal/list.h"
@ -75,4 +73,4 @@ static inline void kernelUnlock(void)
void _eventSlabInit(void);
void _mutexSlabInit(void);
void _semaphoreSlabInit(void);
void _timerInit(void);
void _timerInit(void);

View File

@ -22,6 +22,11 @@
#include "internal/list.h"
#ifdef __cplusplus
extern "C"
{
#endif
typedef ListNode SlabHeap;
@ -61,3 +66,7 @@ void* slabCalloc(SlabHeap *slab, size_t clrSize);
* @param ptr The object slot pointer.
*/
void slabFree(SlabHeap *slab, void *ptr);
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -22,6 +22,11 @@
#ifdef __cplusplus
extern "C"
{
#endif
static inline void spinlockLock(u32 *lock)
{
u32 tmp;
@ -43,3 +48,7 @@ static inline void spinlockUnlock(u32 *lock)
"sev"
: : "r" (0), "r" (lock) : "memory");
}
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -19,5 +19,14 @@
*/
#ifdef __cplusplus
extern "C"
{
#endif
#define LIKELY(expr) __builtin_expect((expr), true)
#define UNLIKELY(expr) __builtin_expect((expr), false)
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -75,4 +75,4 @@ void taskExit(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@ -18,17 +18,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdbool.h>
#include "kernel.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @brief Creates a new kernel event.
*
@ -82,4 +80,4 @@ void clearEvent(KHandle const kevent);
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@ -21,6 +21,7 @@
#include "kernel.h"
#ifdef __cplusplus
extern "C"
{
@ -28,8 +29,6 @@ extern "C"
// TODO: Implement this using semaphores?
/**
* @brief Creates a new kernel mutex.
*
@ -65,4 +64,4 @@ KRes unlockMutex(KHandle const kmutex);
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@ -19,17 +19,15 @@
*/
#include <stdint.h>
#include <stdbool.h>
#include "kernel.h"
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @brief Creates a new kernel semaphore.
*
@ -75,4 +73,4 @@ void signalSemaphore(KHandle const ksema, uint32_t signalCount, bool reschedule)
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@ -21,13 +21,12 @@
#include "kernel.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*KHandle createTimer(bool pulse);
void deleteTimer(KHandle const ktimer);
@ -40,4 +39,4 @@ KRes waitForTimer(KHandle const ktimer);*/
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdbool.h>
#include <stdlib.h>
#include "types.h"
#include "internal/list.h"

View File

@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdbool.h>
#include <stdlib.h>
#include "types.h"
#include "internal/list.h"

View File

@ -16,8 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*#include <stdbool.h>
#include <stdlib.h>
/*#include <stdlib.h>
#include "types.h"
#include "ktimer.h"
#include "internal/list.h"