SST的实现与使用.pptx

  1. 1、本文档共13页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
SST的实现与使用在SST里面的任务与中断优先级同步抢占异步抢占常规抢占式kernelSST kernelSST内核占用1个堆栈在SST里面的临界区#define SST_INT_LOCK() (EA = 0)#define SST_INT_UNLOCK() (EA = 1)在SST里ISR处理1)示例代码static uint32_t temp;#pragma vector = T1_VECTOR__interrupt void timer_isr(void){ uint8_t pin; temp ++; if(OVFIF) { OVFIF = 0; SST_ISR_ENTRY(pin, TICK_ISR_PRIO); sst_post(TICK_TASK_A_PRIO, TICK_SIG, (uint32_t *)temp); /* post the Tick to Task A */ SST_ISR_EXIT(pin, NULL); }}在SST里ISR处理2)SST中断进入\退出宏定义#define SST_ISR_ENTRY(pin_,isrPrio_) do { \(pin_) = SST_currPrio_; \SST_currPrio_ = (isrPrio_); \SST_INT_UNLOCK(); \} while (0)?#define SST_ISR_EXIT(pin_,EOI_command_) do { \SST_INT_LOCK(); \(EOI_command_); \SST_currPrio_ = (pin_); \SST_schedule_(); \} while (0)SST防止优先级反转机制 mutex = sst_mutex_lock(TICK_TASK_B_PRIO); /* the other tick task */sst_post(TICK_TASK_B_PRIO, TICK_SIG, 0); /* post the Tick to Task B */sst_mutex_unlock(mutex);启动多任务和SST空闲任务void tick_task_a(sst_event e) { switch (e.sig) { case INIT_SIG: //add code do something break; case TICK_SIG: { mutex = sst_mutex_lock(TICK_TASK_B_PRIO); /* the other tick task */ sst_post(TICK_TASK_B_PRIO, TICK_SIG, 0); /* post the Tick to Task B */ sst_mutex_unlock(mutex); break; } default: break; }}int main(void) { sst_init(); /* initialize the SST */ sst_task_create(tick_task_a, TICK_TASK_A_PRIO, tick_task_a_queue, sizeof(tick_task_a_queue)/sizeof(tick_task_a_queue[0]), INIT_SIG, 0); … sst_run(); /* run the SST application */ return 0;}void sst_run(void) { (1)sst_start(); /* start ISRs */? (2)SST_INT_LOCK(); (3)sst_curr_prio = (uint8_t)0; /* set the priority for the SST idle loop */ (4)sst_schedule(); /* process all events produced so far */ (5)SST_INT_UNLOCK();? (6) for (;;) { /* the SST idle loop */ (7)sst_onidle(); /* invoke

文档评论(0)

2518887 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档