Skip to content

Commit

Permalink
Reconstructing kernel file structure and remove useless file and code.
Browse files Browse the repository at this point in the history
  • Loading branch information
At-EC committed Apr 29, 2024
1 parent 5fdcc8b commit 4861f25
Show file tree
Hide file tree
Showing 36 changed files with 1,810 additions and 1,941 deletions.
10 changes: 5 additions & 5 deletions .github/remote_build/native_gcc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern "C" {
#define _PC_CMPT_FAILED PC_FAILED(PC_CMPT_KERNEL)
#define SAMPLE_THREAD_STACK_SIZE (1024u)

ATOS_THREAD_DEFINE(sample_thread, SAMPLE_THREAD_STACK_SIZE, 5);
OS_THREAD_DEFINE(sample_thread, SAMPLE_THREAD_STACK_SIZE, 5);

static os_thread_id_t g_sample_thread_id;

Expand All @@ -26,20 +26,20 @@ static void sample_entry_thread(void)
{
while(1) {
/* Put the current thread into sleep state */
AtOS.thread_sleep(1000);
os.thread_sleep(1000);
}
}

int main(void)
{
g_sample_thread_id = AtOS.thread_init(sample_thread, sample_entry_thread);
g_sample_thread_id = os.thread_init(sample_thread, sample_entry_thread);

if (AtOS.id_isInvalid(g_sample_thread_id)) {
if (os.id_isInvalid(g_sample_thread_id)) {
/* return _PC_CMPT_FAILED; */
}

/* At_RTOS kernel running starts */
AtOS.schedule_run();
os.schedule_run();
D_ASSERT(0);

while(1) {};
Expand Down
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,39 +174,45 @@ The following sample codes illustrates how to create your first thread:
#include "at_rtos.h"
/* Define a thread hook to specific the stack size and prioriy of the thread */
ATOS_THREAD_DEFINE(your_thread_define, 1024, 7); // Set the thread stack size to 1024 bytes and the schedule prioriy level to 7.
OS_THREAD_DEFINE(your_thread_define, 1024, 7); // Set the thread stack size to 1024 bytes and the schedule prioriy level to 7.
/* User thread's entry function. */
static void your_thread_entry_function(void)
{
while(1) {
AtOS.thread_sleep(1000u);
os.thread_sleep(1000u);
}
}
/* The main routine */
int main(void)
{
/* Initialize the your your thread. */
os_thread_id_t your_thread_id = AtOS.thread_init(your_thread_define, your_thread_entry_function);
if (AtOS.id_isInvalid(your_thread_id)) {
os_thread_id_t your_thread_id = os.thread_init(your_thread_define, your_thread_entry_function);
if (os.id_isInvalid(your_thread_id)) {
printf("Thread %s init failed\n", your_thread_id.pName);
}
/* The At-RTOS kernel schedule starts to run. */
AtOS.schedule_run();
os.schedule_run();
}
```

Note that: The following c/h files path must be included/contained in your project workshop.
Note that: The following kernel h file path must be included in your project workshop.

- `<root path>`\At-RTOS\
- `<root path>`\At-RTOS\include\
- `<root path>`\At-RTOS\include\kernel\
- `<root path>`\At-RTOS\kernel\<all>.c
- `<root path>`\At-RTOS\clock\clock_systick.c
- `<root path>`\At-RTOS\port\port_common.c
- `<root path>`\At-RTOS\port\<your compiler>.c
```shell
<root path>\
<root path>\include\
<root path>\include\kernel\
```
Note that: The following kernel c file should be placed in your project workshop base on your code compiler.

```shell
<root path>\kernel\<all of them>.c
<root path>\clock\clock_systick.c
<root path>\port\port_common.c
<root path>\port\<your compiler>.c
```

## Roadmap

Expand Down
6 changes: 3 additions & 3 deletions build_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
extern "C" {
#endif

#define ATOS_BUILD_TIME "2024-04-20,15:06"
#define ATOS_COMMIT_HEAD_ID "15ae539784cbd1d3a83e2f08c4cf5c4d7e6a71e8"
#define ATOS_BUILD_TIME "2024-04-29,19:55"
#define ATOS_COMMIT_HEAD_ID "5fdcc8b72c9420a21d603575c9090f051d54301c"
#define ATOS_VERSION_MAJOR_NUMBER (1u)
#define ATOS_VERSION_MINOR_NUMBER (4u)
#define ATOS_VERSION_PATCH_NUMBER (4u)
#define ATOS_VERSION_PATCH_NUMBER (5u)

#define ATOS_VERSION_MAJOR_NUMBER_MASK (0x03FFu)
#define ATOS_VERSION_MAJOR_NUMBER_POS (22u)
Expand Down
14 changes: 7 additions & 7 deletions clock/clock_native_gcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void _clock_time_elapsed_report(u32_t us)
/**
* @brief It's invoked in the SysTick_Handler to maintain the clock system.
*/
void _impl_clock_isr(void)
void clock_isr(void)
{
/* Nothing need to do for kernel cmake sample build. */
}
Expand All @@ -84,7 +84,7 @@ void _impl_clock_isr(void)
*
* @param Value of the next timeout.
*/
void _impl_clock_time_interval_set(u32_t interval_us)
void clock_time_interval_set(u32_t interval_us)
{
/* Nothing need to do for kernel cmake sample build. */
}
Expand All @@ -94,7 +94,7 @@ void _impl_clock_time_interval_set(u32_t interval_us)
*
* @return Value of the unreported elapse time.
*/
u32_t _impl_clock_time_elapsed_get(void)
u32_t clock_time_elapsed_get(void)
{
/* Nothing need to do for kernel cmake sample build. */
return 0u;
Expand All @@ -105,7 +105,7 @@ u32_t _impl_clock_time_elapsed_get(void)
*
* @return Value of the current clock time.
*/
u32_t _impl_clock_time_get(void)
u32_t clock_time_get(void)
{
/* Nothing need to do for kernel cmake sample build. */
return 0u;
Expand All @@ -114,23 +114,23 @@ u32_t _impl_clock_time_get(void)
/**
* @brief Enable the time clock.
*/
void _impl_clock_time_enable(void)
void clock_time_enable(void)
{
/* Nothing need to do for kernel cmake sample build. */
}

/**
* @brief Disable the time clock.
*/
void _impl_clock_time_disable(void)
void clock_time_disable(void)
{
/* Nothing need to do for kernel cmake sample build. */
}

/**
* @brief Init the time clock.
*/
void _impl_clock_time_init(time_report_handler_t pTime_function)
void clock_time_init(time_report_handler_t pTime_function)
{
g_clock_resource.pCallFunc = pTime_function;

Expand Down
14 changes: 7 additions & 7 deletions clock/clock_systick.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static void _clock_time_elapsed_report(u32_t us)
/**
* @brief It's invoked in the SysTick_Handler to maintain the clock system.
*/
void _impl_clock_isr(void)
void clock_isr(void)
{
/**
* For maintain purpose.
Expand All @@ -129,7 +129,7 @@ void _impl_clock_isr(void)
*
* @param Value of the next timeout.
*/
void _impl_clock_time_interval_set(u32_t interval_us)
void clock_time_interval_set(u32_t interval_us)
{
if (interval_us == OS_TIME_FOREVER_VAL) {
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
Expand Down Expand Up @@ -196,7 +196,7 @@ void _impl_clock_time_interval_set(u32_t interval_us)
*
* @return Value of the unreported elapse time.
*/
u32_t _impl_clock_time_elapsed_get(void)
u32_t clock_time_elapsed_get(void)
{
ARCH_ENTER_CRITICAL_SECTION();

Expand All @@ -212,7 +212,7 @@ u32_t _impl_clock_time_elapsed_get(void)
*
* @return Value of the current clock time.
*/
u32_t _impl_clock_time_get(void)
u32_t clock_time_get(void)
{
ARCH_ENTER_CRITICAL_SECTION();

Expand All @@ -226,7 +226,7 @@ u32_t _impl_clock_time_get(void)
/**
* @brief Enable the time clock.
*/
void _impl_clock_time_enable(void)
void clock_time_enable(void)
{
if (!g_clock_resource.ctrl_enabled) {
g_clock_resource.ctrl_enabled = TRUE;
Expand All @@ -237,15 +237,15 @@ void _impl_clock_time_enable(void)
/**
* @brief Disable the time clock.
*/
void _impl_clock_time_disable(void)
void clock_time_disable(void)
{
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
}

/**
* @brief Init the time clock.
*/
void _impl_clock_time_init(time_report_handler_t pTime_function)
void clock_time_init(time_report_handler_t pTime_function)
{
g_clock_resource.pCallFunc = pTime_function;

Expand Down
7 changes: 0 additions & 7 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,13 @@ target_sources(kernel_include
${KERNEL_PATH}/include/kernel/at_rtos.h
${KERNEL_PATH}/include/kernel/compiler.h
${KERNEL_PATH}/include/kernel/configuration.h
${KERNEL_PATH}/include/kernel/event.h
${KERNEL_PATH}/include/kernel/kernel.h
${KERNEL_PATH}/include/kernel/linker.h
${KERNEL_PATH}/include/kernel/list.h
${KERNEL_PATH}/include/kernel/kstruct.h
${KERNEL_PATH}/include/kernel/mutex.h
${KERNEL_PATH}/include/kernel/postcode.h
${KERNEL_PATH}/include/kernel/queue.h
${KERNEL_PATH}/include/kernel/semaphore.h
${KERNEL_PATH}/include/kernel/thread.h
${KERNEL_PATH}/include/kernel/timer.h
${KERNEL_PATH}/include/kernel/trace.h
${KERNEL_PATH}/include/kernel/typedef.h
${KERNEL_PATH}/include/kernel/ktype.h
${KERNEL_PATH}/include/kernel/kthread.h
${KERNEL_PATH}/include/kernel/pool.h
)
14 changes: 7 additions & 7 deletions include/clock_tick.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ typedef void (*time_report_handler_t)(u32_t);
/**
* The implement function lists for rtos kernel internal use.
*/
void _impl_clock_isr(void);
void _impl_clock_time_interval_set(u32_t interval_us);
u32_t _impl_clock_time_elapsed_get(void);
u32_t _impl_clock_time_get(void);
void _impl_clock_time_enable(void);
void _impl_clock_time_disable(void);
void _impl_clock_time_init(time_report_handler_t pTime_function);
void clock_isr(void);
void clock_time_interval_set(u32_t interval_us);
u32_t clock_time_elapsed_get(void);
u32_t clock_time_get(void);
void clock_time_enable(void);
void clock_time_disable(void);
void clock_time_init(time_report_handler_t pTime_function);

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit 4861f25

Please sign in to comment.