mem.h
来自「MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis」· C头文件 代码 · 共 57 行
H
57 行
// This file is part of MANTIS OS, Operating System// See http://mantis.cs.colorado.edu///// Copyright (C) 2003,2004,2005 University of Colorado, Boulder//// This program is free software; you can redistribute it and/or// modify it under the terms of the mos license (see file LICENSE)/** @file kernel/include/mem.h * @brief Memory management system. * * Memory management system for allocating thread stack space in memory. We keep a linked list of free memory blocks and use a best fit match to allocate new blocks. * @author Brian Shucker * @author Edited: Jeff Rose (Converted generic heap to our specific memory * manager.) * @date Created: 11/02/1999 *//** @brief A node of managed memory */typedef struct node_s { /** @brief Size of blocks */ uint16_t size; /** @brief Linked list of pointers */ struct node_s *prev; /** @brief Pointer to ned node */ struct node_s *next;} node_t;#include <inttypes.h>#include "msched.h"/** @brief Initialize the heap with a single free region of memory. * @param region Memory region to initialize * @param size Size of the memory region */void mem_init(void *region, uint16_t size);/** @brief Try to allocate a region of memory. * @param size Size of the region to allocate. * @return NULL if not enough memory is available, else the allocated memory. */void *mos_mem_alloc(uint16_t size);/** @brief Free a block of memory. * @param block Block of memory to free */void mos_mem_free(void *block);/** @brief Check the number of bytes used for a given thread's stack * * @param t The thread who's stack shall be checked. * @return The number of bytes used */uint16_t mos_check_stack(thread_t *t);#ifdef DEBUG_MEMORYvoid print_memory(uint8_t verbose);#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?