91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3.71MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2023-11-19
  • 語言: 其他
  • 標(biāo)簽: OLED??K60??SPI??

資源簡介

本OLED程序例程包含了K60_4WIRE_SPI例程,使用keil軟件開發(fā)環(huán)境,程序注釋完整詳細(xì),可作為學(xué)習(xí)及參考的樣本

資源截圖

代碼片段和文件信息

/*
?*?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?s.ptr))?;?p?=?p->s.ptr)
????{
????????if?((p?>=?p->s.ptr)?&&?((bp?>?p)?||?(bp?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;
????}
}

/*******************************************

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????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個(gè)文件信息

評論

共有 條評論