This commit is contained in:
moyuhai
2026-06-09 16:39:17 +08:00
commit 41a602f89c
3057 changed files with 771495 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
/**
****************************************************************************************
*
* @file ke_env.h
*
* @brief This file contains the definition of the kernel.
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef _KE_ENV_H_
#define _KE_ENV_H_
/**
****************************************************************************************
* @addtogroup ENV Environment
* @ingroup KERNEL
* @brief Kernel Environment
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h" // stack configuration
#include "ke_event.h" // kernel event
#include "co_list.h" // kernel queue definition
// forward declaration
struct mblock_free;
/// Kernel environment definition
struct ke_env_tag
{
/// Queue of sent messages but not yet delivered to receiver
struct co_list queue_sent;
/// Queue of messages delivered but not consumed by receiver
struct co_list queue_saved;
/// Queue of timers
struct co_list queue_timer;
/// Root pointer = pointer to first element of heap linked lists
struct mblock_free * heap[KE_MEM_BLOCK_MAX];
/// Size of heaps
uint16_t heap_size[KE_MEM_BLOCK_MAX];
#if (KE_PROFILING)
/// Size of heap used
uint16_t heap_used[KE_MEM_BLOCK_MAX];
/// Maximum heap memory used
uint32_t max_heap_used;
#endif //KE_PROFILING
};
/// Kernel environment
extern struct ke_env_tag ke_env;
/// @} ENV
#endif // _KE_ENV_H_
+107
View File
@@ -0,0 +1,107 @@
/**
****************************************************************************************
*
* @file ke_queue.h
*
* @brief This file contains the definition of the message object, queue element
* object and queue object
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef _KE_QUEUE_H_
#define _KE_QUEUE_H_
/**
****************************************************************************************
* @addtogroup QUEUE Queues and Lists
* @ingroup KERNEL
* @brief Queue management module
*
* This module implements the functions used for managing message queues.
* These functions must not be called under IRQ!
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include <stdint.h> // standard integer
#include <stdbool.h> // standard boolean
#include "compiler.h" // compiler definitions
#include "co_list.h" // list definition
/*
* FUNCTION PROTOTYPES
****************************************************************************************
*/
/**
****************************************************************************************
* @brief Pop entry to the queue
*
* @param[in] queue Pointer to the queue.
* @param[in] element Pointer to the element.
****************************************************************************************
*/
__INLINE void ke_queue_push(struct co_list *const queue, struct co_list_hdr *const element)
{
co_list_push_back(queue, element);
}
/**
****************************************************************************************
* @brief Pop entry from the queue
*
* @param[in] queue Pointer to the queue.
*
* @return Pointer to the element.
****************************************************************************************
*/
__INLINE struct co_list_hdr *ke_queue_pop(struct co_list *const queue)
{
return co_list_pop_front(queue);
}
/**
****************************************************************************************
* @brief Extracts an element matching a given algorithm.
*
* @param[in] queue Pointer to the queue.
* @param[in] func Matching function.
* @param[in] arg Match argument.
*
* @return Pointer to the element found and removed (NULL otherwise).
****************************************************************************************
*/
struct co_list_hdr *ke_queue_extract(struct co_list * const queue,
bool (*func)(struct co_list_hdr const * elmt, uint32_t arg),
uint32_t arg);
/**
****************************************************************************************
* @brief Insert an element in a sorted queue.
*
* This primitive use a comparison function from the parameter list to select where the
* element must be inserted.
*
* @param[in] queue Pointer to the queue.
* @param[in] element Pointer to the element to insert.
* @param[in] cmp Comparison function (return true if first element has to be inserted
* before the second one).
*
* @return Pointer to the element found and removed (NULL otherwise).
****************************************************************************************
*/
void ke_queue_insert(struct co_list * const queue, struct co_list_hdr * const element,
bool (*cmp)(struct co_list_hdr const *elementA,
struct co_list_hdr const *elementB));
/// @} QUEUE
#endif // _KE_QUEUE_H_