|
发表于 2016-8-25 09:58:32
|
显示全部楼层
不是的,你的理解稍有偏差,这个函数里面的uint16_t的类型定义是指的这个参数的数值大小范围是0到65536。
调函关系是
1.
#define xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask )
xTaskGenericCreate( ( pvTaskCode ), ( pcName ), ( usStackDepth ), ( pvParameters ), ( uxPriority ), ( pxCreatedTask ), ( NULL ), ( NULL ) )
2.
BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, const MemoryRegion_t * const xRegions )
3.
这个函数里面再调用函数pxNewTCB = prvAllocateTCBAndStack( usStackDepth, puxStackBuffer );
prvAllocateTCBAndStack这个函数就是申请动态内存了:
4. 看了这个就明白了
pxStack = ( StackType_t * ) pvPortMallocAligned( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ), puxStackBuffer );
|
|