资源简介
本OLED程序例程包含了K60_4WIRE_SPI例程,使用keil软件开发环境,程序注释完整详细,可作为学习及参考的样本

代码片段和文件信息
/*
* File: alloc.c
* Purpose: generic malloc() and free() engine
*
* Notes: 99% of this code stolen/borrowed from the K&R C
* examples.
*
*/
#include “common.h“
#include “stdlib.h“
#pragma section = “HEAP“
/********************************************************************/
/*
* This struct forms the minimum block size which is allocated and
* also forms the linked list for the memory space used with alloc()
* and free(). It is padded so that on a 32-bit machine all malloc‘ed
* pointers are 16-byte aligned.
*/
typedef struct ALLOC_HDR
{
struct
{
struct ALLOC_HDR *ptr;
unsigned int size;
} s;
unsigned int align;
unsigned int pad;
} ALLOC_HDR;
static ALLOC_HDR base;
static ALLOC_HDR *freep = NULL;
/********************************************************************/
void
free (void *ap)
{
ALLOC_HDR *bp *p;
bp = (ALLOC_HDR *)ap - 1; /* point to block header */
for (p = freep; !((bp > p) && (bp < p->s.ptr)) ; p = p->s.ptr)
{
if ((p >= p->s.ptr) && ((bp > p) || (bp < p->s.ptr)))
{
break; /* freed block at start or end of arena */
}
}
if ((bp + bp->s.size) == p->s.ptr)
{
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
}
else
{
bp->s.ptr = p->s.ptr;
}
if ((p + p->s.size) == bp)
{
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
}
else
{
p->s.ptr = bp;
}
freep = p;
}
/********************************************************************/
void *
malloc (unsigned nbytes)
{
/* Get addresses for the HEAP start and end */
#if (defined(CW))
extern char __HEAP_START;
extern char __HEAP_END[];
#elif (defined(IAR))
char* __HEAP_START = __section_begin(“HEAP“);
char* __HEAP_END = __section_end(“HEAP“);
#endif
ALLOC_HDR *p *prevp;
unsigned nunits;
nunits = ((nbytes+sizeof(ALLOC_HDR)-1) / sizeof(ALLOC_HDR)) + 1;
if ((prevp = freep) == NULL)
{
p = (ALLOC_HDR *)__HEAP_START;
p->s.size = ( ((uint32)__HEAP_END - (uint32)__HEAP_START)
/ sizeof(ALLOC_HDR) );
p->s.ptr = &base;
base.s.ptr = p;
base.s.size = 0;
prevp = freep = &base;
}
for (p = prevp->s.ptr; ; prevp = p p = p->s.ptr)
{
if (p->s.size >= nunits)
{
if (p->s.size == nunits)
{
prevp->s.ptr = p->s.ptr;
}
else
{
p->s.size -= nunits;
p += p->s.size;
p->s.size = nunits;
}
freep = prevp;
return (void *)(p + 1);
}
if (p == freep)
return NULL;
}
}
/*******************************************
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-07-12 11:12 K60_4WIRE_SPI\
文件 191 2013-05-25 16:53 K60_4WIRE_SPI\Demo_OLED.eww
目录 0 2015-07-12 11:12 K60_4WIRE_SPI\build\
目录 0 2015-07-12 11:12 K60_4WIRE_SPI\build\iar\
目录 0 2015-07-12 11:12 K60_4WIRE_SPI\build\iar\config files\
文件 2030 2010-10-27 14:30 K60_4WIRE_SPI\build\iar\config files\128KB_Pflash.icf
文件 2206 2010-11-11 14:41 K60_4WIRE_SPI\build\iar\config files\128KB_Pflash_128KB_Dflash.icf
文件 2034 2010-10-27 14:30 K60_4WIRE_SPI\build\iar\config files\128KB_Ram.icf
文件 2030 2010-10-27 14:30 K60_4WIRE_SPI\build\iar\config files\256KB_Pflash.icf
文件 2214 2010-11-11 14:41 K60_4WIRE_SPI\build\iar\config files\256KB_Pflash_256KB_Dflash.icf
文件 2024 2010-10-27 14:30 K60_4WIRE_SPI\build\iar\config files\32KB_Ram.icf
文件 2041 2010-10-27 14:30 K60_4WIRE_SPI\build\iar\config files\512KB_Pflash.icf
文件 2217 2010-11-11 14:41 K60_4WIRE_SPI\build\iar\config files\64KB_Pflash_64KB_Dflash.icf
文件 2024 2010-10-27 14:30 K60_4WIRE_SPI\build\iar\config files\64KB_Ram.icf
目录 0 2015-07-12 11:12 K60_4WIRE_SPI\build\iar\hello_world\
目录 0 2015-07-12 11:12 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\
目录 0 2015-07-12 11:12 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\Exe\
文件 195912 2014-06-26 09:42 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\Exe\hello_world_K60.out
文件 23296 2014-06-26 09:42 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\Exe\hello_world_K60.srec
目录 0 2015-07-12 11:12 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\
文件 34505 2014-06-26 09:41 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\CRC.lst
文件 22901 2014-06-26 09:41 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\CRC.s
文件 29979 2014-06-26 09:41 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\HAL_SPI.lst
文件 23213 2014-06-26 09:41 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\HAL_SPI.s
文件 31263 2014-05-04 15:25 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\Oled_Printf.lst
文件 22061 2014-05-04 15:25 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\Oled_Printf.s
文件 107529 2014-05-04 15:25 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\Oled_SSD1306.lst
文件 44249 2014-05-04 15:25 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\Oled_SSD1306.s
文件 67363 2014-06-26 09:41 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\SPI_FLASH.lst
文件 43925 2014-06-26 09:41 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\SPI_FLASH.s
文件 20539 2014-06-26 09:41 K60_4WIRE_SPI\build\iar\hello_world\FLASH_512KB_PFLASH\List\adc16.lst
............此处省略1077个文件信息
相关资源
- nmos转移特性曲线hspice程序—&mdas
- Spire API文档
- The direction of synaptic plasticity mediated
- stm32f103c8t6 4 oled.rar
- 飞思卡尔单片机MC9S12XS12G128驱动(硬件
- 51模拟SPI读写SD卡(包括Fat和Fat32文件
- [免费]基于stm32f103ze 的OLED驱动代码
- 28335写的用spi读取传感器数据并用CA
- STM32F103 CC2500完整驱动(模拟SPI)
- 手机短信api接口(源代码)
- cs5530的SPI程序
- 9s12单片机SPI功能代码
- stm32 用SPI 方式读写 SDHC
- SPI Master 的Verilog源代码
- Spire.Doc 破解版
- Spin-1目标的广义parton分布的多项式和
- 介子和S波氘核的四极矩以及对spin-1系
- 基于SPCE061A和PTR8000的模拟SPI总线通信
- 用8位spi实现16位spi
- linux SPI设备注册和驱动小结
- 用Verilog语言写的CPLD和MCU通讯的SPI接口
- Spirent iTest用户手册详细介绍iTest的各
- 精确结果为3d N $$ \\ mathcal {N} $$ = 2 S
- STM32F103实现OV7670摄像头显示
- 从Poincaré代数的闭合中得
- Temperature dependence of electron-spin cohere
- LED/LED背光显示器/OLED显示屏
- QCD中三个循环处的Spin-2形状因子
- STM32分别以串口硬件SPI模拟并口驱动
- stm32利用spi驱动tm1803
评论
共有 条评论