diff --git a/app/samgr/bootstrap_example.c b/app/samgr/bootstrap_example.c index a5977d7ee7c378622b982b23d8c1ea9b297dcebb..794ca354d94d0f5476039cd9494ce5fffba2ec49 100644 --- a/app/samgr/bootstrap_example.c +++ b/app/samgr/bootstrap_example.c @@ -77,8 +77,8 @@ static const char *FEATURE_GetName(Feature *feature) static void FEATURE_OnInitialize(Feature *feature, Service *parent, Identity identity) { (void)identity; - printf("[Boot Test][TaskID:%u][Step:%u][Reg Finish S:%s, F:%s]Time: %llu!\n", - (int)osThreadGetId(), g_initIndex++, parent->GetName(parent), feature->GetName(feature), + printf("[Boot Test][TaskID:%p][Step:%u][Reg Finish S:%s, F:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_initIndex++, parent->GetName(parent), feature->GetName(feature), SAMGR_GetProcessTime()); } @@ -90,8 +90,8 @@ static void FEATURE_OnStop(Feature *feature, Identity identity) static BOOL FEATURE_OnMessage(Feature *feature, Request *request) { - printf("[Boot Test][TaskID:%u][Step:%u][F:%s] msgId<%d> \n", - (int)osThreadGetId(), g_initIndex++, feature->GetName(feature), request->msgId); + printf("[Boot Test][TaskID:%p][Step:%u][F:%s] msgId<%d> \n", + (void*)osThreadGetId(), g_initIndex++, feature->GetName(feature), request->msgId); return FALSE; } @@ -119,15 +119,15 @@ static const char *GetName(Service *service) static BOOL Initialize(Service *service, Identity identity) { (void)identity; - printf("[Boot Test][TaskID:%u][Step:%u][Reg Finish S:%s]Time: %llu!\n", - (int)osThreadGetId(), g_initIndex++, service->GetName(service), SAMGR_GetProcessTime()); + printf("[Boot Test][TaskID:%p][Step:%u][Reg Finish S:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_initIndex++, service->GetName(service), SAMGR_GetProcessTime()); return TRUE; } static BOOL MessageHandle(Service *service, Request *msg) { - printf("[Boot Test][TaskID:%u][Step:%u][S:%s] msgId<%d> \n", - (int)osThreadGetId(), g_initIndex++, service->GetName(service), msg->msgId); + printf("[Boot Test][TaskID:%p][Step:%u][S:%s] msgId<%d> \n", + (void*)osThreadGetId(), g_initIndex++, service->GetName(service), msg->msgId); return FALSE; } @@ -141,13 +141,13 @@ static TaskConfig GetTaskConfig(Service *service) static void MInit(void) { - printf("[Boot Test][TaskID:%u][Step:%u][CORE INIT]Time: %llu!\n", - (int)osThreadGetId(), g_initIndex++, SAMGR_GetProcessTime()); + printf("[Boot Test][TaskID:%p][Step:%u][CORE INIT]Time: %llu!\n", + (void*)osThreadGetId(), g_initIndex++, SAMGR_GetProcessTime()); } static void MRun(void) { - printf("[Boot Test][TaskID:%u][Step:%u][SYS RUN]Time: %llu!\n", - (int)osThreadGetId(), g_initIndex++, SAMGR_GetProcessTime()); + printf("[Boot Test][TaskID:%p][Step:%u][SYS RUN]Time: %llu!\n", + (void*)osThreadGetId(), g_initIndex++, SAMGR_GetProcessTime()); } static void SInit(BootTestExample *demo) @@ -156,9 +156,9 @@ static void SInit(BootTestExample *demo) // test cases service 2 printf((demo < &g_example[2]) ? - "[Boot Test][TaskID:%u][Step:%u][SYS Reg S:%s]Time: %llu!\n" : - "[Boot Test][TaskID:%u][Step:%u][SYSEX Reg S:%s]Time: %llu!\n", - (int)osThreadGetId(), g_initIndex++, demo->service.GetName(&demo->service), SAMGR_GetProcessTime()); + "[Boot Test][TaskID:%p][Step:%u][SYS Reg S:%s]Time: %llu!\n" : + "[Boot Test][TaskID:%p][Step:%u][SYSEX Reg S:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_initIndex++, demo->service.GetName(&demo->service), SAMGR_GetProcessTime()); } static void FInit(BootTestExample *demo) @@ -167,9 +167,9 @@ static void FInit(BootTestExample *demo) // test cases service 2 printf((demo < &g_example[2]) ? - "[Boot Test][TaskID:%u][Step:%u][SYS Reg S:%s, F:%s]Time: %llu!\n" : - "[Boot Test][TaskID:%u][Step:%u][SYSEX Reg S:%s, F:%s]Time: %llu!\n", - (int)osThreadGetId(), g_initIndex++, demo->service.GetName(&demo->service), + "[Boot Test][TaskID:%p][Step:%u][SYS Reg S:%s, F:%s]Time: %llu!\n" : + "[Boot Test][TaskID:%p][Step:%u][SYSEX Reg S:%s, F:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_initIndex++, demo->service.GetName(&demo->service), demo->feature.GetName(&demo->feature), SAMGR_GetProcessTime()); } diff --git a/app/samgr/broadcast_example.c b/app/samgr/broadcast_example.c index 5449be169384023d58be3e3392b3f2528e6d1828..7e385b1b662b2e35cbf5ef93a17f5921e647eae7 100644 --- a/app/samgr/broadcast_example.c +++ b/app/samgr/broadcast_example.c @@ -32,16 +32,16 @@ static void C1Callback(Consumer *consumer, const Topic *topic, const Request *re { (void)consumer; (void)topic; - printf("[Broadcast Test][TaskID:%u][Step:%u][C1 Callback]c1 is being called data is :%s \n", - (int)osThreadGetId(), g_callbackStep++, (char *)request->data); + printf("[Broadcast Test][TaskID:%p][Step:%u][C1 Callback]c1 is being called data is :%s \n", + (void*)osThreadGetId(), g_callbackStep++, (char *)request->data); } static void C2Callback(Consumer *consumer, const Topic *topic, const Request *request) { (void)consumer; (void)topic; - printf("[Broadcast Test][TaskID:%u][Step:%u][C2 Callback]c2 is being called data is :%s \n", - (int)osThreadGetId(), g_callbackStep++, (char *)request->data); + printf("[Broadcast Test][TaskID:%p][Step:%u][C2 Callback]c2 is being called data is :%s \n", + (void*)osThreadGetId(), g_callbackStep++, (char *)request->data); } static BOOL Equal(const Consumer *current, const Consumer *other) @@ -62,14 +62,14 @@ static BOOL Initialize(Service *service, Identity identity) { g_identity = identity; (void)service; - printf("[Broadcast Test][TaskID:%u][Step:%u][Reg Finish S:%s]Time: %llu!\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE, SAMGR_GetProcessTime()); + printf("[Broadcast Test][TaskID:%p][Step:%u][Reg Finish S:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE, SAMGR_GetProcessTime()); return TRUE; }; static BOOL MessageHandle(Service *service, Request *msg) { - printf("[Broadcast Test][TaskID:%u] msgId<%d>: %s \n", (int)osThreadGetId(), msg->msgId, (char *)msg->data); + printf("[Broadcast Test][TaskID:%p] msgId<%d>: %s \n", (void*)osThreadGetId(), msg->msgId, (char *)msg->data); (void)service; return FALSE; }; @@ -86,8 +86,8 @@ static Service g_testService = {GetName, Initialize, MessageHandle, GetTaskConfi static void Init(void) { SAMGR_GetInstance()->RegisterService(&g_testService); - printf("[Broadcast Test][TaskID:%u][Step:%u][Reg S:%s]Time: %llu!\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE, SAMGR_GetProcessTime()); + printf("[Broadcast Test][TaskID:%p][Step:%u][Reg S:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE, SAMGR_GetProcessTime()); } SYSEX_SERVICE_INIT(Init); @@ -95,26 +95,26 @@ SYSEX_SERVICE_INIT(Init); static PubSubInterface *CASE_GetIUnknown(void) { PubSubInterface *fapi = NULL; - printf("[Broadcast Test][TaskID:%u][Step:%u][GetIUnknown S:%s]: BEGIN\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); + printf("[Broadcast Test][TaskID:%p][Step:%u][GetIUnknown S:%s]: BEGIN\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE, PUB_SUB_FEATURE); if (iUnknown == NULL) { - printf("[Broadcast Test][TaskID:%u][Step:%u][GetDefaultFeatureApi S:%s]Error is NULL!\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); + printf("[Broadcast Test][TaskID:%p][Step:%u][GetDefaultFeatureApi S:%s]Error is NULL!\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); goto END; } int result = iUnknown->QueryInterface(iUnknown, DEFAULT_VERSION, (void **)&fapi); if (result != 0 || fapi == NULL) { - printf("[Broadcast Test][TaskID:%u][Step:%u][QueryInterface S:%s]Error is NULL!\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); + printf("[Broadcast Test][TaskID:%p][Step:%u][QueryInterface S:%s]Error is NULL!\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); goto END; } - printf("[Broadcast Test][TaskID:%u][Step:%u][GetIUnknown S:%s]Success\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); + printf("[Broadcast Test][TaskID:%p][Step:%u][GetIUnknown S:%s]Success\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); END: - printf("[Broadcast Test][TaskID:%u][Step:%u][GetIUnknown S:%s]: END\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); + printf("[Broadcast Test][TaskID:%p][Step:%u][GetIUnknown S:%s]: END\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); return fapi; } @@ -128,7 +128,7 @@ static void CASE_AddAndUnsubscribeTopic(PubSubInterface *fapi) static Consumer c1 = {.identity = &g_identity, .Notify = C1Callback, .Equal = Equal}; static Consumer c2 = {.identity = &g_identity, .Notify = C2Callback, .Equal = Equal}; // add topic test - printf("[Topic Test][TaskID:%u][Step:%u][Add Topic]: BEGIN\n", (int)osThreadGetId(), g_addTopicStep++); + printf("[Topic Test][TaskID:%p][Step:%u][Add Topic]: BEGIN\n", (void*)osThreadGetId(), g_addTopicStep++); Topic topic0 = 0; subscriber->AddTopic((IUnknown *)fapi, &topic0); subscriber->Subscribe((IUnknown *)fapi, &topic0, &c1); @@ -139,10 +139,10 @@ static void CASE_AddAndUnsubscribeTopic(PubSubInterface *fapi) subscriber->Subscribe((IUnknown *)fapi, &topic1, &c1); subscriber->Subscribe((IUnknown *)fapi, &topic1, &c2); provider->Publish((IUnknown *)fapi, &topic1, (uint8_t *) "==>444<==", TEST_LEN); - printf("[Topic Test][TaskID:%u][Step:%u][Add Topic]: Success!\n", (int)osThreadGetId(), g_addTopicStep++); - printf("[Topic Test][TaskID:%u][Step:%u][Add Topic]: END\n", (int)osThreadGetId(), g_addTopicStep++); + printf("[Topic Test][TaskID:%p][Step:%u][Add Topic]: Success!\n", (void*)osThreadGetId(), g_addTopicStep++); + printf("[Topic Test][TaskID:%p][Step:%u][Add Topic]: END\n", (void*)osThreadGetId(), g_addTopicStep++); // unsubscribe topic0 test - printf("[Topic Test][TaskID:%u][Step:%u][Unsubscribe Topic]: BEGIN\n", (int)osThreadGetId(), + printf("[Topic Test][TaskID:%p][Step:%u][Unsubscribe Topic]: BEGIN\n", (void*)osThreadGetId(), g_unsubscribeTopicStep++); LOS_Msleep(WAIT_PUB_PROC); subscriber->Unsubscribe((IUnknown *)fapi, &topic0, &c1); @@ -151,9 +151,9 @@ static void CASE_AddAndUnsubscribeTopic(PubSubInterface *fapi) subscriber->Unsubscribe((IUnknown *)fapi, &topic0, &c2); provider->Publish((IUnknown *)fapi, &topic0, (uint8_t *) "@@@333@@@", TEST_LEN); provider->Publish((IUnknown *)fapi, &topic1, (uint8_t *) "@@@444@@@", TEST_LEN); - printf("[Topic Test][TaskID:%u][Step:%u][Unsubscribe Topic]: Success!\n", - (int)osThreadGetId(), g_unsubscribeTopicStep++); - printf("[Topic Test][TaskID:%u][Step:%u][Unsubscribe Topic]: END\n", (int)osThreadGetId(), + printf("[Topic Test][TaskID:%p][Step:%u][Unsubscribe Topic]: Success!\n", + (void*)osThreadGetId(), g_unsubscribeTopicStep++); + printf("[Topic Test][TaskID:%p][Step:%u][Unsubscribe Topic]: END\n", (void*)osThreadGetId(), g_unsubscribeTopicStep++); } @@ -166,7 +166,7 @@ static void CASE_ModifyConsumer(PubSubInterface *fapi) static Consumer c1 = {.identity = &g_identity, .Notify = C1Callback, .Equal = Equal}; static Consumer c2 = {.identity = &g_identity, .Notify = C2Callback, .Equal = Equal}; // modify consumer test - printf("[Topic Test][TaskID:%u][Step:%u][Modify Consumer]: BEGIN\n", (int)osThreadGetId(), + printf("[Topic Test][TaskID:%p][Step:%u][Modify Consumer]: BEGIN\n", (void*)osThreadGetId(), g_modifyConsumerStep++); Topic topic2 = 0x100; subscriber->AddTopic((IUnknown *)fapi, &topic2); @@ -175,9 +175,9 @@ static void CASE_ModifyConsumer(PubSubInterface *fapi) LOS_Msleep(WAIT_PUB_PROC); subscriber->ModifyConsumer((IUnknown *)fapi, &topic2, &c1, &c2); provider->Publish((IUnknown *)fapi, &topic2, (uint8_t *) "@@@555@@@", TEST_LEN); - printf("[Topic Test][TaskID:%u][Step:%u][Modify Consumer]: Success!\n", (int)osThreadGetId(), + printf("[Topic Test][TaskID:%p][Step:%u][Modify Consumer]: Success!\n", (void*)osThreadGetId(), g_modifyConsumerStep++); - printf("[Topic Test][TaskID:%u][Step:%u][Modify Consumer]: END\n", (int)osThreadGetId(), + printf("[Topic Test][TaskID:%p][Step:%u][Modify Consumer]: END\n", (void*)osThreadGetId(), g_modifyConsumerStep++); } @@ -188,7 +188,7 @@ static void CASE_ReUnsubscribeTopic(PubSubInterface *fapi) Subscriber *subscriber = &fapi->subscriber; Provider *provider = &fapi->provider; static Consumer c1 = {.identity = &g_identity, .Notify = C1Callback, .Equal = Equal}; - printf("[Topic Test][TaskID:%u][Step:%u][ReUnsubscribe Topic]: BEGIN\n", (int)osThreadGetId(), + printf("[Topic Test][TaskID:%p][Step:%u][ReUnsubscribe Topic]: BEGIN\n", (void*)osThreadGetId(), g_reUnsubscribeTopic++); Topic topic3 = 0x1000; subscriber->AddTopic((IUnknown *)fapi, &topic3); @@ -197,36 +197,36 @@ static void CASE_ReUnsubscribeTopic(PubSubInterface *fapi) LOS_Msleep(WAIT_PUB_PROC); Consumer *retConsumer = subscriber->Unsubscribe((IUnknown *)fapi, &topic3, &c1); if (retConsumer == NULL) { - printf("[Topic Test][TaskID:%u][Step:%u][ReUnsubscribe Topic]: Unsubscribe Topic lead to NULL return value\n", - (int)osThreadGetId(), g_reUnsubscribeTopic++); + printf("[Topic Test][TaskID:%p][Step:%u][ReUnsubscribe Topic]: Unsubscribe Topic lead to NULL return value\n", + (void*)osThreadGetId(), g_reUnsubscribeTopic++); } retConsumer = subscriber->Unsubscribe((IUnknown *)fapi, &topic3, &c1); if (retConsumer == NULL) { - printf("[Topic Test][TaskID:%u][Step:%u][ReUnsubscribe Topic]: ReUnsubscribe Topic lead to NULL return value\n", - (int)osThreadGetId(), g_reUnsubscribeTopic++); + printf("[Topic Test][TaskID:%p][Step:%u][ReUnsubscribe Topic]: ReUnsubscribe Topic lead to NULL return value\n", + (void*)osThreadGetId(), g_reUnsubscribeTopic++); } provider->Publish((IUnknown *)fapi, &topic3, (uint8_t *) "@@@666@@@", TEST_LEN); - printf("[Topic Test][TaskID:%u][Step:%u][ReUnsubscribe Topic]: Success!\n", - (int)osThreadGetId(), g_reUnsubscribeTopic++); - printf("[Topic Test][TaskID:%u][Step:%u][ReUnsubscribe Topic]: END\n", (int)osThreadGetId(), + printf("[Topic Test][TaskID:%p][Step:%u][ReUnsubscribe Topic]: Success!\n", + (void*)osThreadGetId(), g_reUnsubscribeTopic++); + printf("[Topic Test][TaskID:%p][Step:%u][ReUnsubscribe Topic]: END\n", (void*)osThreadGetId(), g_reUnsubscribeTopic++); } static void CASE_ReleaseIUnknown(PubSubInterface *fapi) { - printf("[Broadcast Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s]: BEGIN\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); + printf("[Broadcast Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s]: BEGIN\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); int32 ref = fapi->Release((IUnknown *)fapi); if (ref <= 0) { - printf("[Broadcast Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s]Error ref is %d!\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE, ref); + printf("[Broadcast Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s]Error ref is %d!\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE, ref); goto END; } - printf("[Broadcast Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s]Success\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); + printf("[Broadcast Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s]Success\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); END: - printf("[Broadcast Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s]: END\n", - (int)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); + printf("[Broadcast Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s]: END\n", + (void*)osThreadGetId(), g_broadcastStep++, BROADCAST_TEST_SERVICE); } static void RunTestCase(void) diff --git a/app/samgr/feature_example.c b/app/samgr/feature_example.c index 692f46986e1273815e729755bdc3dc30197afa4e..23dbd40c2d0fe676f37303597b67a5745409dc05 100644 --- a/app/samgr/feature_example.c +++ b/app/samgr/feature_example.c @@ -86,8 +86,8 @@ static void FEATURE_OnInitialize(Feature *feature, Service *parent, Identity ide { DemoFeature *demoFeature = (DemoFeature *)feature; demoFeature->identity = identity; - printf("[Register Test][TaskID:%u][Step:%u][Reg Finish S:%s, F:%s]Time: %llu!\n", - (int)osThreadGetId(), g_regStep++, parent->GetName(parent), feature->GetName(feature), + printf("[Register Test][TaskID:%p][Step:%u][Reg Finish S:%s, F:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_regStep++, parent->GetName(parent), feature->GetName(feature), SAMGR_GetProcessTime()); } @@ -106,8 +106,8 @@ static BOOL FEATURE_OnMessage(Feature *feature, Request *request) { (void)feature; if (request->msgId == MSG_PROC) { - printf("[LPC Test][TaskID:%u][Step:%u][OnMessage: S:%s, F:%s] msgId %s \n", - (int)osThreadGetId(), g_asyncStep++, EXAMPLE_SERVICE, feature->GetName(feature), + printf("[LPC Test][TaskID:%p][Step:%u][OnMessage: S:%s, F:%s] msgId %s \n", + (void*)osThreadGetId(), g_asyncStep++, EXAMPLE_SERVICE, feature->GetName(feature), (char *)request->data); Response response = {.data = "Yes, you did!", .len = 0}; SAMGR_SendResponse(request, &response); @@ -115,15 +115,15 @@ static BOOL FEATURE_OnMessage(Feature *feature, Request *request) } else { if (request->msgId == MSG_TIME_PROC) { LOS_Msleep(WAIT_FEATURE_PROC * 11); // sleep 11 seconds - printf("[LPC Test][TaskID:%u][OnMessage: S:%s, F:%s] Time Message Get Value<%s>!", - (int)osThreadGetId(), EXAMPLE_SERVICE, feature->GetName(feature), + printf("[LPC Test][TaskID:%p][OnMessage: S:%s, F:%s] Time Message Get Value<%s>!", + (void*)osThreadGetId(), EXAMPLE_SERVICE, feature->GetName(feature), request->msgValue ? "TRUE" : "FALSE"); AsyncTimeCall(GET_IUNKNOWN(g_example)); return FALSE; } } - printf("[LPC Test][TaskID:%u][Step:%u][OnMessage S:%s, F:%s] Inner Error! \n", - (int)osThreadGetId(), g_asyncStep++, EXAMPLE_SERVICE, feature->GetName(feature)); + printf("[LPC Test][TaskID:%p][Step:%u][OnMessage S:%s, F:%s] Inner Error! \n", + (void*)osThreadGetId(), g_asyncStep++, EXAMPLE_SERVICE, feature->GetName(feature)); return FALSE; } @@ -131,11 +131,11 @@ static BOOL SyncCall(IUnknown *iUnknown, struct Payload *payload) { (void)iUnknown; if (payload != NULL && payload->id >= 0 && payload->name != NULL) { - printf("[LPC Test][TaskID:%u][Step:%u][SyncCall API] Id:%d, name:%s, value:%d \n", - (int)osThreadGetId(), g_asyncStep++, payload->id, payload->name, payload->value); + printf("[LPC Test][TaskID:%p][Step:%u][SyncCall API] Id:%d, name:%s, value:%d \n", + (void*)osThreadGetId(), g_asyncStep++, payload->id, payload->name, payload->value); return TRUE; } - printf("[LPC Test][TaskID:%u][Step:%u][SyncCall API] Input Error! \n", (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][SyncCall API] Input Error! \n", (void*)osThreadGetId(), g_asyncStep++); return FALSE; } @@ -152,7 +152,7 @@ static BOOL AsyncCall(IUnknown *iUnknown, const char *body) return FALSE; } DemoFeature *feature = GET_OBJECT(iUnknown, DemoFeature, iUnknown); - printf("[LPC Test][TaskID:%u][Step:%u][AsyncCall API] Send request! \n", (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][AsyncCall API] Send request! \n", (void*)osThreadGetId(), g_asyncStep++); return SAMGR_SendRequest(&feature->identity, &request, NULL); } @@ -178,8 +178,8 @@ static BOOL AsyncCallBack(IUnknown *iUnknown, const char *body, Handler handler) return FALSE; } DemoFeature *feature = GET_OBJECT(iUnknown, DemoFeature, iUnknown); - printf("[LPC Test][TaskID:%u][Step:%u][AsyncCallBack API] Send request! \n", - (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][AsyncCallBack API] Send request! \n", + (void*)osThreadGetId(), g_asyncStep++); return SAMGR_SendRequest(&feature->identity, &request, handler); } @@ -187,8 +187,8 @@ static void Init(void) { SAMGR_GetInstance()->RegisterFeature(EXAMPLE_SERVICE, (Feature *)&g_example); SAMGR_GetInstance()->RegisterFeatureApi(EXAMPLE_SERVICE, EXAMPLE_FEATURE, GET_IUNKNOWN(g_example)); - printf("[Register Test][TaskID:%u][Step:%u][Reg S:%s, F:%s]Time: %llu!\n", - (int)osThreadGetId(), g_regStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE, SAMGR_GetProcessTime()); + printf("[Register Test][TaskID:%p][Step:%u][Reg S:%s, F:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_regStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE, SAMGR_GetProcessTime()); } SYSEX_FEATURE_INIT(Init); @@ -198,25 +198,25 @@ static uint32_t g_discoverStep = 0; static DemoApi *CASE_GetIUnknown(void) { DemoApi *demoApi = NULL; - printf("[Discover Test][TaskID:%u][Step:%u][GetIUnknown S:%s, F:%s]: BEGIN\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); + printf("[Discover Test][TaskID:%p][Step:%u][GetIUnknown S:%s, F:%s]: BEGIN\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); IUnknown *iUnknown = SAMGR_GetInstance()->GetFeatureApi(EXAMPLE_SERVICE, EXAMPLE_FEATURE); if (iUnknown == NULL) { - printf("[Discover Test][TaskID:%u][Step:%u][GetFeatureApi S:%s, F:%s]Error is NULL!\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); + printf("[Discover Test][TaskID:%p][Step:%u][GetFeatureApi S:%s, F:%s]Error is NULL!\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); goto END; } int result = iUnknown->QueryInterface(iUnknown, DEFAULT_VERSION, (void **)&demoApi); if (result != 0 || demoApi == NULL) { - printf("[Discover Test][TaskID:%u][Step:%u][QueryInterface S:%s, F:%s]Error is NULL!\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); + printf("[Discover Test][TaskID:%p][Step:%u][QueryInterface S:%s, F:%s]Error is NULL!\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); goto END; } - printf("[Discover Test][TaskID:%u][Step:%u][GetIUnknown S:%s, F:%s]Success\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); + printf("[Discover Test][TaskID:%p][Step:%u][GetIUnknown S:%s, F:%s]Success\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); END: - printf("[Discover Test][TaskID:%u][Step:%u][GetIUnknown S:%s, F:%s]: END\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); + printf("[Discover Test][TaskID:%p][Step:%u][GetIUnknown S:%s, F:%s]: END\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); return demoApi; } @@ -225,22 +225,22 @@ static void CASE_SyncCall(DemoApi *demoApi) if (demoApi->SyncCall == NULL) { return; } - printf("[LPC Test][TaskID:%u][Step:%u][SyncCall]: BEGIN! \n", (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][SyncCall]: BEGIN! \n", (void*)osThreadGetId(), g_asyncStep++); struct Payload payload = { .id = 0, .name = "I want to sync call good result!", .value = 1 }; if (!demoApi->SyncCall((IUnknown *)demoApi, &payload)) { - printf("[LPC Test][TaskID:%u][Step:%u][SyncCall]Error return false! \n", - (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][SyncCall]Error return false! \n", + (void*)osThreadGetId(), g_asyncStep++); goto END; } - printf("[LPC Test][TaskID:%u][Step:%u][SyncCall]Success!\n", - (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][SyncCall]Success!\n", + (void*)osThreadGetId(), g_asyncStep++); END: - printf("[LPC Test][TaskID:%u][Step:%u][SyncCall]: END\n", - (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][SyncCall]: END\n", + (void*)osThreadGetId(), g_asyncStep++); } @@ -249,18 +249,18 @@ static void CASE_AsyncCall(DemoApi *demoApi) if (demoApi->AsyncCall == NULL) { return; } - printf("[LPC Test][TaskID:%u][Step:%u][AsyncCall]: BEGIN! \n", (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][AsyncCall]: BEGIN! \n", (void*)osThreadGetId(), g_asyncStep++); uint32 count = g_asyncStep; demoApi->AsyncCall((IUnknown *)demoApi, "I want to async call good result!"); LOS_Msleep(WAIT_FEATURE_PROC); if (count == g_asyncStep) { - printf("[LPC Test][TaskID:%u][Step:%u][AsyncCall] result is failed! \n", (int)osThreadGetId(), + printf("[LPC Test][TaskID:%p][Step:%u][AsyncCall] result is failed! \n", (void*)osThreadGetId(), g_asyncStep++); goto END; } - printf("[LPC Test][TaskID:%u][Step:%u][AsyncCall]Success! \n", (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][AsyncCall]Success! \n", (void*)osThreadGetId(), g_asyncStep++); END: - printf("[LPC Test][TaskID:%u][Step:%u][AsyncCall]: END! \n", (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][AsyncCall]: END! \n", (void*)osThreadGetId(), g_asyncStep++); } static void CASE_AsyncTimeCall(DemoApi *demoApi) @@ -274,9 +274,9 @@ static void CASE_AsyncTimeCall(DemoApi *demoApi) void AsyncHandler(const Request *request, const Response *response) { (void)request; - printf("[LPC Test][TaskID:%u][Step:%u][AsyncCallBack]Success! Response:%s \n", - (int)osThreadGetId(), g_asyncStep++, (char *)response->data); - printf("[LPC Test][TaskID:%u][Step:%u][AsyncCallBack]: END! \n", (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][AsyncCallBack]Success! Response:%s \n", + (void*)osThreadGetId(), g_asyncStep++, (char *)response->data); + printf("[LPC Test][TaskID:%p][Step:%u][AsyncCallBack]: END! \n", (void*)osThreadGetId(), g_asyncStep++); } static void CASE_AsyncCallBack(DemoApi *demoApi) @@ -284,27 +284,27 @@ static void CASE_AsyncCallBack(DemoApi *demoApi) if (demoApi->AsyncCallBack == NULL) { return; } - printf("[LPC Test][TaskID:%u][Step:%u][AsyncCallBack]: BEGIN! \n", (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][AsyncCallBack]: BEGIN! \n", (void*)osThreadGetId(), g_asyncStep++); demoApi->AsyncCallBack((IUnknown *)demoApi, "I want to async call callback good result!", AsyncHandler); - printf("[LPC Test][TaskID:%u][Step:%u][AsyncCallBack]Wait for response! \n", - (int)osThreadGetId(), g_asyncStep++); + printf("[LPC Test][TaskID:%p][Step:%u][AsyncCallBack]Wait for response! \n", + (void*)osThreadGetId(), g_asyncStep++); } static void CASE_ReleaseIUnknown(DemoApi *demoApi) { - printf("[Discover Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s, F:%s]: BEGIN\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); + printf("[Discover Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s, F:%s]: BEGIN\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); int32 ref = demoApi->Release((IUnknown *)demoApi); if (ref <= 0) { - printf("[Discover Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s, F:%s]Error ref is %d!\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE, ref); + printf("[Discover Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s, F:%s]Error ref is %d!\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE, ref); goto END; } - printf("[Discover Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s, F:%s]Success\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); + printf("[Discover Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s, F:%s]Success\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); END: - printf("[Discover Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s, F:%s]: END\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); + printf("[Discover Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s, F:%s]: END\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, EXAMPLE_FEATURE); } static void RunTestCase(void) diff --git a/app/samgr/service_example.c b/app/samgr/service_example.c index de411f0ab9e20b5d4b4d965fa14feab41712b267..e95444157d302cda85ca54c7aa7cdd8ddacc0d64 100644 --- a/app/samgr/service_example.c +++ b/app/samgr/service_example.c @@ -48,14 +48,14 @@ static BOOL Initialize(Service *service, Identity identity) { ExampleService *example = (ExampleService *)service; example->identity = identity; - printf("[Register Test][TaskID:%u][Step:%u][Reg Finish S:%s]Time: %llu!\n", - (int)osThreadGetId(), g_regStep++, service->GetName(service), SAMGR_GetProcessTime()); + printf("[Register Test][TaskID:%p][Step:%u][Reg Finish S:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_regStep++, service->GetName(service), SAMGR_GetProcessTime()); return TRUE; } static BOOL MessageHandle(Service *service, Request *msg) { - printf("[LPC Test][TaskID:%u] msgId<%d>: %s \n", (int)osThreadGetId(), msg->msgId, (char *)msg->data); + printf("[LPC Test][TaskID:%p] msgId<%d>: %s \n", (void*)osThreadGetId(), msg->msgId, (char *)msg->data); (void)service; return FALSE; } @@ -73,7 +73,7 @@ static volatile uint32 g_asyncStep = 0; static void SyncCall(IUnknown *iUnknown) { (void)iUnknown; - printf("[LPC Test][TaskID:%u][Step:%u][SyncCall API] Default Success!\n", (int)osThreadGetId(), + printf("[LPC Test][TaskID:%p][Step:%u][SyncCall API] Default Success!\n", (void*)osThreadGetId(), g_asyncStep++); } @@ -91,8 +91,8 @@ static void Init(void) { SAMGR_GetInstance()->RegisterService((Service *)&g_example); SAMGR_GetInstance()->RegisterDefaultFeatureApi(EXAMPLE_SERVICE, GET_IUNKNOWN(g_example)); - printf("[Register Test][TaskID:%u][Step:%u][Reg S:%s]Time: %llu!\n", - (int)osThreadGetId(), g_regStep++, EXAMPLE_SERVICE, SAMGR_GetProcessTime()); + printf("[Register Test][TaskID:%p][Step:%u][Reg S:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_regStep++, EXAMPLE_SERVICE, SAMGR_GetProcessTime()); } SYSEX_SERVICE_INIT(Init); @@ -102,52 +102,52 @@ static uint32_t g_discoverStep = 0; static DefaultFeatureApi *CASE_GetIUnknown(void) { DefaultFeatureApi *demoApi = NULL; - printf("[Discover Test][TaskID:%u][Step:%u][GetIUnknown S:%s]: BEGIN\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); + printf("[Discover Test][TaskID:%p][Step:%u][GetIUnknown S:%s]: BEGIN\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); IUnknown *iUnknown = SAMGR_GetInstance()->GetDefaultFeatureApi(EXAMPLE_SERVICE); if (iUnknown == NULL) { - printf("[Discover Test][TaskID:%u][Step:%u][GetDefaultFeatureApi S:%s]Error is NULL!\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); + printf("[Discover Test][TaskID:%p][Step:%u][GetDefaultFeatureApi S:%s]Error is NULL!\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); goto END; } int result = iUnknown->QueryInterface(iUnknown, DEFAULT_VERSION, (void **)&demoApi); if (result != 0 || demoApi == NULL) { - printf("[Discover Test][TaskID:%u][Step:%u][QueryInterface S:%s]Error is NULL!\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); + printf("[Discover Test][TaskID:%p][Step:%u][QueryInterface S:%s]Error is NULL!\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); goto END; } - printf("[Discover Test][TaskID:%u][Step:%u][GetIUnknown S:%s]Success\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); + printf("[Discover Test][TaskID:%p][Step:%u][GetIUnknown S:%s]Success\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); END: - printf("[Discover Test][TaskID:%u][Step:%u][GetIUnknown S:%s]: END\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); + printf("[Discover Test][TaskID:%p][Step:%u][GetIUnknown S:%s]: END\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); return demoApi; } static void CASE_SyncCall(DefaultFeatureApi *defaultApi) { - printf("[LPC Test][TaskID:%u][Step:%u][DefaultFeature SyncCall]: BEGIN\n", (int)osThreadGetId(), + printf("[LPC Test][TaskID:%p][Step:%u][DefaultFeature SyncCall]: BEGIN\n", (void*)osThreadGetId(), g_asyncStep++); defaultApi->SyncCall((IUnknown *)defaultApi); - printf("[LPC Test][TaskID:%u][Step:%u][DefaultFeature SyncCall]: END\n", (int)osThreadGetId(), + printf("[LPC Test][TaskID:%p][Step:%u][DefaultFeature SyncCall]: END\n", (void*)osThreadGetId(), g_asyncStep++); } static void CASE_ReleaseIUnknown(DefaultFeatureApi *demoApi) { - printf("[Discover Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s]: BEGIN\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); + printf("[Discover Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s]: BEGIN\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); int32 ref = demoApi->Release((IUnknown *)demoApi); if (ref <= 0) { - printf("[Discover Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s]Error ref is %d!\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, ref); + printf("[Discover Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s]Error ref is %d!\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE, ref); goto END; } - printf("[Discover Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s]Success\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); + printf("[Discover Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s]Success\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); END: - printf("[Discover Test][TaskID:%u][Step:%u][ReleaseIUnknown S:%s]: END\n", - (int)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); + printf("[Discover Test][TaskID:%p][Step:%u][ReleaseIUnknown S:%s]: END\n", + (void*)osThreadGetId(), g_discoverStep++, EXAMPLE_SERVICE); } static void CASE_RegisterInvalidService(void) diff --git a/app/samgr/specified_task_example.c b/app/samgr/specified_task_example.c index e146227f84e740cc4b6844081bf3151385c94b57..b3d7d94f94980222fb837d85dc3ddbb62884b226 100644 --- a/app/samgr/specified_task_example.c +++ b/app/samgr/specified_task_example.c @@ -138,15 +138,15 @@ static const char *GetSpec3Name(Service *service) static BOOL Initialize(Service *service, Identity identity) { (void)identity; - printf("[Specified Task Test][TaskID:%u][Step:%u][Reg Finish S:%s]Time: %llu!\n", - (int)osThreadGetId(), g_initIndex++, service->GetName(service), SAMGR_GetProcessTime()); + printf("[Specified Task Test][TaskID:%p][Step:%u][Reg Finish S:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_initIndex++, service->GetName(service), SAMGR_GetProcessTime()); return TRUE; } static BOOL MessageHandle(Service *service, Request *msg) { - printf("[Specified Task Test][TaskID:%u][Step:%u][S:%s] msgId<%d> \n", - (int)osThreadGetId(), g_initIndex++, service->GetName(service), msg->msgId); + printf("[Specified Task Test][TaskID:%p][Step:%u][S:%s] msgId<%d> \n", + (void*)osThreadGetId(), g_initIndex++, service->GetName(service), msg->msgId); return FALSE; } @@ -199,8 +199,8 @@ static void SInit(Service *demo) { SAMGR_GetInstance()->RegisterService(demo); - printf("[Specified Task Test][TaskID:%u][Step:%u][SYSEX Reg S:%s]Time: %llu!\n", - (int)osThreadGetId(), g_initIndex++, demo->GetName(demo), SAMGR_GetProcessTime()); + printf("[Specified Task Test][TaskID:%p][Step:%u][SYSEX Reg S:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_initIndex++, demo->GetName(demo), SAMGR_GetProcessTime()); } static void SSInit(void) diff --git a/app/samgr/task_example.c b/app/samgr/task_example.c index cec06227f7ba65652e7be40930b16ec7d27ee8e1..0677170ddd52606db7b438a4fd27cee0a5321a69 100644 --- a/app/samgr/task_example.c +++ b/app/samgr/task_example.c @@ -58,15 +58,15 @@ static const char *GetName(Service *service) static BOOL Initialize(Service *service, Identity identity) { (void)identity; - printf("[Task Test][TaskID:%u][Step:%u][Reg Finish S:%s]Time: %llu!\n", - (int)osThreadGetId(), g_initIndex++, service->GetName(service), SAMGR_GetProcessTime()); + printf("[Task Test][TaskID:%p][Step:%u][Reg Finish S:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_initIndex++, service->GetName(service), SAMGR_GetProcessTime()); return TRUE; } static BOOL MessageHandle(Service *service, Request *msg) { - printf("[Task Test][TaskID:%u][Step:%u][S:%s] msgId<%d> \n", - (int)osThreadGetId(), g_initIndex++, service->GetName(service), msg->msgId); + printf("[Task Test][TaskID:%p][Step:%u][S:%s] msgId<%d> \n", + (void*)osThreadGetId(), g_initIndex++, service->GetName(service), msg->msgId); return FALSE; } @@ -89,8 +89,8 @@ static void SInit(Service *demo) { SAMGR_GetInstance()->RegisterService(demo); - printf("[Task Test][TaskID:%u][Step:%u][SYSEX Reg S:%s]Time: %llu!\n", - (int)osThreadGetId(), g_initIndex++, demo->GetName(demo), SAMGR_GetProcessTime()); + printf("[Task Test][TaskID:%p][Step:%u][SYSEX Reg S:%s]Time: %llu!\n", + (void*)osThreadGetId(), g_initIndex++, demo->GetName(demo), SAMGR_GetProcessTime()); } static void S1Init(void)