本文整理汇总了C++中LOGI函数的典型用法代码示例。如果您正苦于以下问题:C++ LOGI函数的具体用法?C++ LOGI怎么用?C++ LOGI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOGI函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: httpGet
int httpGet(char* hostname,char *url)
{
LOGI("httpGet");
LOGI(hostname);
//char myurl[BUFFSIZE] = {0};
//char host[BUFFSIZE] = {0};
//char GET[BUFFSIZE] = {0};
struct sockaddr_in sin;
int sockfd;
if ((sockfd = socket (AF_INET, SOCK_STREAM, 0)) == -1) {
LOGE(strerror(errno));
return -100;
}
struct hostent * host_addr = gethostbyname(hostname);
if(host_addr==NULL) {
LOGE(strerror(errno));
return -103;
}
sin.sin_family = AF_INET;
sin.sin_port = htons( (unsigned short)80);
sin.sin_addr.s_addr = *((unsigned long*)host_addr->h_addr_list[0]);
if( connect (sockfd,(const struct sockaddr *)&sin, sizeof(struct sockaddr_in) ) == -1 ) {
LOGE(strerror(errno));
return -101;
}
LOGI("httpGet send");
// 向WEB服务器发送URL信息
memset(request, 0, BUFFSIZE);
strcat(request, url); //请求内容与http版本
//strcat(request, "GET /index.html HTTP/1.1\r\n"); //请求内容与http版本
strcat(request, "HOST:"); //主机名,,格式:"HOST:主机"
strcat(request, hostname);
strcat(request, "\r\n");
strcat(request, "Accept:*/*\r\n"); //接受类型,所有类型
// strcat(request, "User-Agent:Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)");//指定浏览器类型?
// strcat(request, "Connection: Keep-Alive\r\n");//设置连接,保持连接
// strcat(request, "Set Cookie:0\r\n");//设置Cookie
// strcat(request, "Range: bytes=0 - 500\r\n");//设置请求字符串起止位置,断点续传关键"Range: bytes=999 -"
strcat(request, "\r\n");//空行表示结束
LOGI(request);
if( send (sockfd, request, strlen(request), 0) == -1){
LOGE(strerror(errno));
return -99;
}
LOGI("httpGet recv");
struct timeval tv_out;
tv_out.tv_sec = 5;
tv_out.tv_usec = 0;
setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv_out, sizeof(tv_out));
memset(text,0,BUFFSIZE);
int recv_size = 0,all_size = 0;
while((recv_size = recv (sockfd, text + all_size, 1024*1024*1024, 0)) != 0){
all_size += recv_size;
if(all_size > 5*1024*1024)
break;
}
//LOGI(text);
LOGI("httpGet end");
close(sockfd);
return 0;
}
开发者ID:sdgdsffdsfff,项目名称:mail-jobs-monitor,代码行数:64,代码来源:mail.c
示例2: JNI_OnLoad
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved)
{
LOGI("Loading native library compiled at " __TIME__ " " __DATE__);
sVm = jvm;
return JNI_VERSION_1_2;
}
开发者ID:ahaedike,项目名称:android-ffmpeg-wrapper,代码行数:6,代码来源:co_pillon_baptiste_ffmpeg_Processor.c
示例3: engine_init_display
/**
* Initialize an EGL context for the current display.
*/
static int engine_init_display(struct engine* engine,bool p_gl2) {
// initialize OpenGL ES and EGL
/*
* Here specify the attributes of the desired configuration.
* Below, we select an EGLConfig with at least 8 bits per color
* component compatible with on-screen windows
*/
const EGLint gl2_attribs[] = {
// EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BLUE_SIZE, 4,
EGL_GREEN_SIZE, 4,
EGL_RED_SIZE, 4,
EGL_ALPHA_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
const EGLint gl1_attribs[] = {
// EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BLUE_SIZE, 4,
EGL_GREEN_SIZE, 4,
EGL_RED_SIZE, 4,
EGL_ALPHA_SIZE, 0,
EGL_DEPTH_SIZE, 16,
EGL_STENCIL_SIZE, EGL_DONT_CARE,
EGL_NONE
};
const EGLint *attribs=p_gl2?gl2_attribs:gl1_attribs;
EGLint w, h, dummy, format;
EGLint numConfigs;
EGLConfig config;
EGLSurface surface;
EGLContext context;
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(display, 0, 0);
/* Here, the application chooses the configuration it desires. In this
* sample, we have a very simplified selection process, where we pick
* the first EGLConfig that matches our criteria */
eglChooseConfig(display, attribs, &config, 1, &numConfigs);
LOGI("Num configs: %i\n",numConfigs);
/* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
* guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
* As soon as we picked a EGLConfig, we can safely reconfigure the
* ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);
ANativeWindow_setBuffersGeometry(engine->app->window, 0, 0, format);
//ANativeWindow_setFlags(engine->app->window, 0, 0, format|);
surface = eglCreateWindowSurface(display, config, engine->app->window, NULL);
const EGLint context_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION,2,
EGL_NONE
};
context = eglCreateContext(display, config, EGL_NO_CONTEXT, p_gl2?context_attribs:NULL);
if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
LOGW("Unable to eglMakeCurrent");
return -1;
}
eglQuerySurface(display, surface, EGL_WIDTH, &w);
eglQuerySurface(display, surface, EGL_HEIGHT, &h);
print_line("INIT VIDEO MODE: "+itos(w)+","+itos(h));
//engine->os->set_egl_extensions(eglQueryString(display,EGL_EXTENSIONS));
engine->os->init_video_mode(w,h);
engine->display = display;
engine->context = context;
engine->surface = surface;
engine->width = w;
engine->height = h;
engine->display_active=true;
//engine->state.angle = 0;
// Initialize GL state.
//glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glEnable(GL_CULL_FACE);
// glShadeModel(GL_SMOOTH);
glDisable(GL_DEPTH_TEST);
//.........这里部分代码省略.........
开发者ID:lonesurvivor,项目名称:godot,代码行数:101,代码来源:godot_android.cpp
示例4: LOGI
// Destructor
WarpTV::~WarpTV(void)
{
LOGI("%s(L=%d)", __func__, __LINE__);
stop();
}
开发者ID:Johnta,项目名称:EffecTV_for_Android,代码行数:6,代码来源:WarpTV.cpp
示例5: DEF_JNI
static jobject DEF_JNI(createSubprocess,
jstring cmd, jstring arg0, jstring arg1,
jobjectArray envVars, jintArray processIdArray)
{
char const* cmd_str = cmd ? env->GetStringUTFChars(cmd, NULL) : NULL;
char const* arg0_str = arg0 ? env->GetStringUTFChars(arg0, NULL) : NULL;
char const* arg1_str = arg1 ? env->GetStringUTFChars(arg1, NULL) : NULL;
LOGI("cmd_str = '%s'", cmd_str);
LOGI("arg0_str = '%s'", arg0_str);
LOGI("arg1_str = '%s'", arg1_str);
int num_env_vars = envVars ? env->GetArrayLength(envVars) : 0;
char **envp = NULL;
char const* tmp = NULL;
if (num_env_vars > 0)
{
envp = (char **)malloc((num_env_vars + 1) * sizeof(char*));
if (!envp)
{
throwOutOfMemoryError(env, "Couldn't allocate envp array");
return NULL;
}
for (int i = 0; i < num_env_vars; ++i)
{
jobject obj = env->GetObjectArrayElement(envVars, i);
jstring env_var = reinterpret_cast<jstring>(obj);
tmp = env->GetStringUTFChars(env_var, 0);
if (tmp == NULL)
{
throwOutOfMemoryError(env, "Couldn't get env var from array");
return NULL;
}
envp[i] = strdup(tmp);
if (envp[i] == NULL)
{
throwOutOfMemoryError(env, "Couldn't strdup() env var");
return NULL;
}
env->ReleaseStringUTFChars(env_var, tmp);
}
envp[num_env_vars] = NULL;
}
int procId;
int ptm = create_subprocess(cmd_str, arg0_str, arg1_str, envp, &procId);
env->ReleaseStringUTFChars(cmd, cmd_str);
if(arg0 != NULL) env->ReleaseStringUTFChars(arg0, arg0_str);
if(arg1 != NULL) env->ReleaseStringUTFChars(arg1, arg1_str);
for (int i = 0; i < num_env_vars; ++i)
free(envp[i]);
free(envp);
if (processIdArray) {
int procIdLen = env->GetArrayLength(processIdArray);
if (procIdLen > 0) {
jboolean isCopy;
int* pProcId = (int*) env->GetPrimitiveArrayCritical(processIdArray, &isCopy);
if (pProcId) {
*pProcId = procId;
env->ReleasePrimitiveArrayCritical(processIdArray, pProcId, 0);
}
}
}
jobject result = env->NewObject(class_fileDescriptor, method_fileDescriptor_init);
if (!result) {
LOGE("Couldn't create a FileDescriptor.");
}
else {
env->SetIntField(result, field_fileDescriptor_descriptor, ptm);
}
return result;
}
开发者ID:abscasey,项目名称:vimtouch,代码行数:87,代码来源:termExec.cpp
示例6: glCreateProgram
bool TeapotRenderer::loadShaders(SHADER_PARAMS* params, const char* strVsh, const char* strFsh)
{
GLuint program;
GLuint vertShader, fragShader;
char *vertShaderPathname, *fragShaderPathname;
// Create shader program
program = glCreateProgram();
LOGI("Created Shader %d", program);
// Create and compile vertex shader
if (!shader::compileShader(&vertShader, GL_VERTEX_SHADER, strVsh)) {
LOGI("Failed to compile vertex shader");
glDeleteProgram(program);
return false;
}
// Create and compile fragment shader
if (!shader::compileShader(&fragShader, GL_FRAGMENT_SHADER, strFsh)) {
LOGI("Failed to compile fragment shader");
glDeleteProgram(program);
return false;
}
// Attach vertex shader to program
glAttachShader(program, vertShader);
// Attach fragment shader to program
glAttachShader(program, fragShader);
// Bind attribute locations
// this needs to be done prior to linking
glBindAttribLocation(program, ATTRIB_VERTEX, "myVertex");
glBindAttribLocation(program, ATTRIB_NORMAL, "myNormal");
glBindAttribLocation(program, ATTRIB_UV, "myUV");
// Link program
if (!shader::linkProgram(program)) {
LOGI("Failed to link program: %d", program);
if (vertShader) {
glDeleteShader(vertShader);
vertShader = 0;
}
if (fragShader) {
glDeleteShader(fragShader);
fragShader = 0;
}
if (program) {
glDeleteProgram(program);
}
return false;
}
// Get uniform locations
params->_uiMatrixP = glGetUniformLocation(program, "uPMatrix");
params->_uiMatrixView = glGetUniformLocation(program, "uMVMatrix");
params->_uiLight0 = glGetUniformLocation(program, "vLight0");
params->_uiMaterialDiffuse = glGetUniformLocation(program,
"vMaterialDiffuse");
params->_uiMaterialAmbient = glGetUniformLocation(program,
"vMaterialAmbient");
params->_uiMaterialSpecular = glGetUniformLocation(program,
"vMaterialSpecular");
// Release vertex and fragment shaders
if (vertShader)
glDeleteShader(vertShader);
if (fragShader)
glDeleteShader(fragShader);
params->_program = program;
return true;
}
开发者ID:Siemnok,项目名称:platform_development,代码行数:76,代码来源:TeapotRenderer.cpp
示例7: LOGI
void GPGSManager::SignOut() {
if (gameServices->IsAuthorized()) {
LOGI("SignOut");
gameServices->SignOut();
}
}
开发者ID:xiedantibu,项目名称:TankMultiplayer,代码行数:6,代码来源:GPGSManager.cpp
示例8: switch
void GPGSManager::ShowMatchInbox()
{
gameServices->TurnBasedMultiplayer().ShowMatchInboxUI([](gpg::TurnBasedMultiplayerManager::MatchInboxUIResponse const & response)
{
if (response.status == gpg::UIStatus::VALID) {
//Show game based on the user's selection
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent("showConnectingPopWindow");
current_match_ = response.match;
switch (response.match.Status()) {
case gpg::MatchStatus::THEIR_TURN:
{//Manage match with dismiss, leave and cancel options
LOGI("Their turn...By Jacky");
// auto notouchlayer = NoTouchLayer::create();
// notouchlayer->setTag(NOTOUCHTAG);
// cocos2d::Director::getInstance()->getRunningScene()->addChild(notouchlayer,100);
// notouchlayer->setError("It's not your turn.");
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent("showNotYourTurnPopWindow");
}
break;
case gpg::MatchStatus::MY_TURN:
{//Play selected game
LOGI("My turn...By Jacky...");
//add notouch layer.
// auto notouchlayer = NoTouchLayer::create();
// notouchlayer->setTag(NOTOUCHTAG);
// cocos2d::Director::getInstance()->getRunningScene()->addChild(notouchlayer,100);
//PlayGame(response.match);
current_match_ = response.match;
ParseMatchData();
//todo:is second turn?
int cur_match_turn = GetMatchTurn();//no found, must return 0;
cur_match_turn++;
if(cur_match_turn == 1){
setPlayer1Name();
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent("enterWagonSelect_1");
}
else if(cur_match_turn ==2){
setPlayer2Name();
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent("enterWagonSelect_2");
}
else if(cur_match_turn >=3){
LOGI("curmatchturn is %d",cur_match_turn);
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent("enterGame");
}
else
{
LOGI("Current_match_turn is a invalid number ====>>>%d", cur_match_turn);
// std::string err = "Current_match_turn is a invalid number : %d" + cocos2d::Value((int)cur_match_turn).asString();
// NoTouchLayer* notouchlayer = ((NoTouchLayer*)(cocos2d::Director::getInstance()->getRunningScene()->getChildByTag(NOTOUCHTAG)));
// if(notouchlayer)
// notouchlayer->setError(err);
}
}
break;
case gpg::MatchStatus::COMPLETED:
//Manage match with dismiss, rematch options
LOGI("Completed...By Jacky");
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent("showItsCompletedPopWindow");
//cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent("TakeTurnSuccess");
break;
case gpg::MatchStatus::EXPIRED:
default:
//Manage match with dismiss option
LOGI("Expired & default...By Jacky");
//add notouch layer.
// auto notouchlayer = NoTouchLayer::create();
// notouchlayer->setTag(NOTOUCHTAG);
// cocos2d::Director::getInstance()->getRunningScene()->addChild(notouchlayer,100);
//enter game
current_match_ = response.match;
ParseMatchData();
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent("enterGame");
break;
}
} else {
LOGI("Invalid MatchInboxUIResponse response status...%d...By Jacky", response.status);
}
});
}
开发者ID:xiedantibu,项目名称:TankMultiplayer,代码行数:85,代码来源:GPGSManager.cpp
示例9: android_main
/**
* アプリケーション開始
*/
void android_main(struct android_app* state) {
struct engine engine;
// glueが削除されないように
app_dummy();
memset(&engine, 0, sizeof(engine));
state->userData = &engine;
state->onAppCmd = engine_handle_cmd;
state->onInputEvent = engine_handle_input;
engine.app = state;
// センサーからのデータ取得に必要な初期化
engine.sensorManager = ASensorManager_getInstance();
engine.accelerometerSensor = ASensorManager_getDefaultSensor(
engine.sensorManager, ASENSOR_TYPE_ACCELEROMETER);
engine.sensorEventQueue = ASensorManager_createEventQueue(
engine.sensorManager, state->looper, LOOPER_ID_USER, NULL,
NULL);
if (state->savedState != NULL) {
// 以前の状態に戻す
engine.state = *(struct saved_state*) state->savedState;
}
while (1) {
int ident;
int events;
struct android_poll_source* source;
// アプリケーションが動作することになれば、これらセンサーの制御を行う
while ((ident = ALooper_pollAll(engine.animating ? 0 : -1, NULL,
&events, (void**) &source)) >= 0) {
// イベントを処理する
if (source != NULL) {
source->process(state, source);
}
// センサーに何かしらのデータが存在したら処理する
if (ident == LOOPER_ID_USER) {
if (engine.accelerometerSensor != NULL) {
ASensorEvent event;
while (ASensorEventQueue_getEvents(
engine.sensorEventQueue, &event, 1) > 0) {
LOGI("accelerometer: x=%f y=%f z=%f",
event.acceleration.x, event.acceleration.y,
event.acceleration.z);
}
}
}
// 破棄要求があったか
if (state->destroyRequested != 0) {
engine_term_display(&engine);
return;
}
}
if (engine.animating) {
// 次のフレームを描画するのに必要な処理を行う
engine.state.angle += .01f;
if (engine.state.angle > 1) {
engine.state.angle = 0;
}
// 画面描画
engine_draw_frame(&engine);
}
}
}
开发者ID:h-godai,项目名称:ssa,代码行数:75,代码来源:main.cpp
示例10: jpeg_CreateDecompress
jpeg_CreateDecompress (j_decompress_ptr cinfo, int version, size_t structsize)
{
int i;
/* Guard against version mismatches between library and caller. */
cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called */
if (version != JPEG_LIB_VERSION)
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
if (structsize != sizeof(struct jpeg_decompress_struct))
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
(int) sizeof(struct jpeg_decompress_struct), (int) structsize);
/* For debugging purposes, we zero the whole master structure.
* But the application has already set the err pointer, and may have set
* client_data, so we have to save and restore those fields.
* Note: if application hasn't set client_data, tools like Purify may
* complain here.
*/
{
struct jpeg_error_mgr * err = cinfo->err;
void * client_data = cinfo->client_data; /* ignore Purify complaint here */
MEMZERO(cinfo, sizeof(struct jpeg_decompress_struct));
cinfo->err = err;
cinfo->client_data = client_data;
}
cinfo->is_decompressor = TRUE;
/* Initialize a memory manager instance for this object */
jinit_memory_mgr((j_common_ptr) cinfo);
/* Zero out pointers to permanent structures. */
cinfo->progress = NULL;
cinfo->src = NULL;
for (i = 0; i < NUM_QUANT_TBLS; i++)
cinfo->quant_tbl_ptrs[i] = NULL;
for (i = 0; i < NUM_HUFF_TBLS; i++) {
cinfo->dc_huff_tbl_ptrs[i] = NULL;
cinfo->ac_huff_tbl_ptrs[i] = NULL;
}
/* Initialize marker processor so application can override methods
* for COM, APPn markers before calling jpeg_read_header.
*/
cinfo->marker_list = NULL;
jinit_marker_reader(cinfo);
/* And initialize the overall input controller. */
jinit_input_controller(cinfo);
/* OK, I'm ready */
cinfo->global_state = DSTATE_START;
/* The master struct is used to store extension parameters, so we allocate it
* here.
*/
LOGI("=========%s:%d", __func__, __LINE__);
cinfo->master = (struct jpeg_decomp_master *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
sizeof(my_decomp_master));
LOGI("=========%s:%d", __func__, __LINE__);
MEMZERO(cinfo->master, sizeof(my_decomp_master));
}
开发者ID:siwenhu,项目名称:gitStudy,代码行数:64,代码来源:jdapimin.c
示例11: LOGE
OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorProcess(
OMX_BUFFERHEADERTYPE ***pBuffers,
buffer_retain_t *retains,
OMX_U32)
{
OMX_ERRORTYPE ret;
OMX_BUFFERHEADERTYPE *inBuffer = *pBuffers[INPORT_INDEX];
OMX_BUFFERHEADERTYPE *outBuffer = *pBuffers[OUTPORT_INDEX];
OMX_BOOL isResolutionChange = OMX_FALSE;
if (inBuffer->pBuffer == NULL) {
LOGE("Buffer to decode is empty.");
return OMX_ErrorBadParameter;
}
if (inBuffer->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
LOGI("Buffer has OMX_BUFFERFLAG_CODECCONFIG flag.");
}
if (inBuffer->nFlags & OMX_BUFFERFLAG_DECODEONLY) {
LOGW("Buffer has OMX_BUFFERFLAG_DECODEONLY flag.");
}
if (inBuffer->nFlags & OMX_BUFFERFLAG_EOS) {
if (inBuffer->nFilledLen == 0) {
(*pBuffers[OUTPORT_INDEX])->nFilledLen = 0;
(*pBuffers[OUTPORT_INDEX])->nFlags = OMX_BUFFERFLAG_EOS;
return OMX_ErrorNone;
}
}
if (vpx_codec_decode((vpx_codec_ctx_t *)mCtx,
inBuffer->pBuffer + inBuffer->nOffset,
inBuffer->nFilledLen,
NULL,
0)) {
LOGE("on2 decoder failed to decode frame.");
return OMX_ErrorBadParameter;
}
ret = FillRenderBuffer(pBuffers[OUTPORT_INDEX],
&retains[OUTPORT_INDEX],
((*pBuffers[INPORT_INDEX]))->nFlags,
&isResolutionChange);
if (ret == OMX_ErrorNone) {
(*pBuffers[OUTPORT_INDEX])->nTimeStamp = inBuffer->nTimeStamp;
}
if (isResolutionChange) {
HandleFormatChange();
}
bool inputEoS = ((*pBuffers[INPORT_INDEX])->nFlags & OMX_BUFFERFLAG_EOS);
bool outputEoS = ((*pBuffers[OUTPORT_INDEX])->nFlags & OMX_BUFFERFLAG_EOS);
// if output port is not eos, retain the input buffer
// until all the output buffers are drained.
if (inputEoS && !outputEoS) {
retains[INPORT_INDEX] = BUFFER_RETAIN_GETAGAIN;
// the input buffer is retained for draining purpose.
// Set nFilledLen to 0 so buffer will not be decoded again.
(*pBuffers[INPORT_INDEX])->nFilledLen = 0;
}
if (ret == OMX_ErrorNotReady) {
retains[OUTPORT_INDEX] = BUFFER_RETAIN_GETAGAIN;
ret = OMX_ErrorNone;
}
return ret;
}
开发者ID:knone1,项目名称:boot,代码行数:71,代码来源:OMXVideoDecoderVP9HWR.cpp
示例12: __HAL_RCC_GPIOA_CLK_ENABLE
void cHAL::Init(void) {
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_CAN2_CLK_ENABLE();
__HAL_RCC_CAN1_CLK_ENABLE();
__HAL_RCC_USART3_CLK_ENABLE();
__HAL_RCC_UART4_CLK_ENABLE();
GPIO_InitTypeDef gi;
HAL_StatusTypeDef status;
//Enable UART
gi.Pin = GPIO_PIN_10 | GPIO_PIN_11; //C10=TX, C11=RX
gi.Mode = GPIO_MODE_AF_PP;
gi.Pull = GPIO_PULLUP;
gi.Speed = GPIO_SPEED_LOW;
gi.Alternate = GPIO_AF7_USART3;
HAL_GPIO_Init(GPIOC, &gi);
InitAndTestUSART();
//Onboard LEDs
gi.Mode = GPIO_MODE_OUTPUT_PP;
gi.Alternate = 0;
gi.Pull = GPIO_NOPULL;
gi.Speed = GPIO_SPEED_LOW;
gi.Pin = GPIO_PIN_7;
HAL_GPIO_Init(GPIOB, &gi);
LOGI(BSP::SUCCESSFUL_STRING, "GPIO for LED");
if(InitDWTCounter())
{
LOGI(BSP::SUCCESSFUL_STRING, "DWTCounter");
}
else
{
LOGE(NOT_SUCCESSFUL_STRING, "DWTCounter");
}
//MP3-Player
gi.Pin = GPIO_PIN_0 | GPIO_PIN_1; //A0=USART4_TX, A1=USART4_RX, Kerbe nach oben; ansicht von Pinseite, rechts von oben
//VCC, RX, TX, DACR, DACL, SPK1, GND, SPK2
//Also: PA0 --> RX
gi.Mode = GPIO_MODE_AF_PP;
gi.Pull = GPIO_PULLUP;
gi.Speed = GPIO_SPEED_LOW;
gi.Alternate = GPIO_AF8_UART4;
HAL_GPIO_Init(GPIOA, &gi);
BELL.Instance = UART4;
BELL.Init.BaudRate = 9600;
BELL.Init.WordLength = UART_WORDLENGTH_8B;
BELL.Init.StopBits = UART_STOPBITS_1;
BELL.Init.Parity = UART_PARITY_NONE;
BELL.Init.Mode = UART_MODE_TX_RX;
BELL.Init.HwFlowCtl = UART_HWCONTROL_NONE;
BELL.Init.OverSampling = UART_OVERSAMPLING_16;
HAL_UART_Init(&BSP::BELL);
LOGI(SUCCESSFUL_STRING, "UART4 for MP3-Module");
__I2C1_CLK_ENABLE();
__I2C2_CLK_ENABLE();
/*
PB08 ------> I2C1_SCL
PB09 ------> I2C1_SDA
*/
gi.Pin = GPIO_PIN_8 | GPIO_PIN_9;
gi.Mode = GPIO_MODE_AF_OD;
gi.Pull = GPIO_PULLUP;
gi.Speed = GPIO_SPEED_MEDIUM;
gi.Alternate = GPIO_AF4_I2C1;
HAL_GPIO_Init(GPIOB, &gi);
/*
PB10 ------> I2C2_SCL
PB11 ------> I2C2_SDA
*/
gi.Pin = GPIO_PIN_10 | GPIO_PIN_11;
gi.Mode = GPIO_MODE_AF_OD;
gi.Pull = GPIO_PULLUP;
gi.Speed = GPIO_SPEED_MEDIUM;
gi.Alternate = GPIO_AF4_I2C2;
HAL_GPIO_Init(GPIOB, &gi);
i2cbus[0].Instance = I2C1;
i2cbus[0].Init.ClockSpeed = 100000;
i2cbus[0].Init.DutyCycle = I2C_DUTYCYCLE_2;
i2cbus[0].Init.OwnAddress1 = 0;
i2cbus[0].Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
i2cbus[0].Init.DualAddressMode = I2C_DUALADDRESS_DISABLED;
i2cbus[0].Init.OwnAddress2 = 0;
i2cbus[0].Init.GeneralCallMode = I2C_GENERALCALL_DISABLED;
i2cbus[0].Init.NoStretchMode = I2C_NOSTRETCH_DISABLED;
HAL_I2C_Init(&i2cbus[0]);
LOGI("I2C1 configured for onboard digital io");
i2cbus[1].Instance = I2C2;
i2cbus[1].Init.ClockSpeed = 100000;
i2cbus[1].Init.DutyCycle = I2C_DUTYCYCLE_2;
i2cbus[1].Init.OwnAddress1 = 0;
i2cbus[1].Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
//.........这里部分代码省略.........
开发者ID:klaus-liebler,项目名称:sensact,代码行数:101,代码来源:cHal_init.cpp
示例13: getSignature
/**
* 获取Signature签名实例
*/
jobject getSignature(JNIEnv* env, jobject thiz){
//获取包名
jstring jstr_packageName = (jstring) CallJavaMethodByName(env,
thiz, "getPackageName", "()Ljava/lang/String;").l;
if ((*env)->ExceptionCheck(env) || jstr_packageName == NULL) {
LOGI("can't get jstr of getPackageName");
return NULL;
}
//获取包名的字符串
const char* loc_str_app_packageName = (*env)->GetStringUTFChars(env,
jstr_packageName, NULL);
if (loc_str_app_packageName == NULL) {
LOGI("can't get packagename from jstring");
return NULL;
}
//当前应用包名与合法包名对比
if (strcmp(loc_str_app_packageName, global_app_packageName) != 0) {
LOGI("this app is illegal");
return NULL;
}
//释放loc_str_app_packageName
(*env)->ReleaseStringUTFChars(env, jstr_packageName,
loc_str_app_packageName);
// 获得应用包的管理器
jobject package_manager = CallJavaMethodByName(env, thiz,
"getPackageManager", "()Landroid/content/pm/PackageManager;").l;
if ((*env)->ExceptionCheck(env) || package_manager == NULL) {
LOGI("can't get obj of getPackageManager");
return NULL;
}
// 获得应用包的信息
jobject package_info = CallJavaMethodByName(env,
package_manager, "getPackageInfo",
"(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;",
(*env)->NewStringUTF(env, global_app_packageName), 64).l;
if ((*env)->ExceptionCheck(env) || package_info == NULL) {
(*env)->ExceptionClear(env);
LOGI("can't get obj of package_info");
return NULL;
}
// 获得 PackageInfo 类
jclass pi_clazz = (*env)->GetObjectClass(env, package_info);
// 获得签名数组属性的 ID
jfieldID fieldID_signatures = (*env)->GetFieldID(env, pi_clazz,
"signatures", "[Landroid/content/pm/Signature;");
(*env)->DeleteLocalRef(env, pi_clazz);
// 得到签名数组,待修改
jobjectArray signatures = (*env)->GetObjectField(env, package_info,
fieldID_signatures);
if ((*env)->ExceptionCheck(env) || signatures == NULL) {
LOGI("can't get jobjectArray of signatures");
return NULL;
}
// 得到签名
jobject signature = (*env)->GetObjectArrayElement(env, signatures, 0);
if ((*env)->ExceptionCheck(env) || signature == NULL) {
LOGI("can't get obj of signature");
return NULL;
}
return signature;
}
开发者ID:djun100,项目名称:JNICheckSignature,代码行数:74,代码来源:hello-jni.c
示例14: native_jniCheckAPP
JNIEXPORT void native_jniCheckAPP(JNIEnv* env, jobject thiz) {
LOGI("start jniCheckAPP");
if(do_check_signature(env, thiz) != 1){
CallJavaMethodByName(env, thiz, "popAlarm", "()V");
}
}
开发者ID:djun100,项目名称:JNICheckSignature,代码行数:6,代码来源:hello-jni.c
示例15: get_args
// command line args come from, in decreasing precedence:
// - the actual command line
// - the bootloader control block (one per line, after "recovery")
// - the contents of COMMAND_FILE (one per line)
static void
get_args(int *argc, char ***argv) {
struct bootloader_message boot;
memset(&boot, 0, sizeof(boot));
get_bootloader_message(&boot); // this may fail, leaving a zeroed structure
if (boot.command[0] != 0 && boot.command[0] != 255) {
LOGI("Boot command: %.*s\n", sizeof(boot.command), boot.command);
}
if (boot.status[0] != 0 && boot.status[0] != 255) {
LOGI("Boot status: %.*s\n", sizeof(boot.status), boot.status);
}
// --- if arguments weren't supplied, look in the bootloader control block
if (*argc <= 1) {
boot.recovery[sizeof(boot.recovery) - 1] = '\0'; // Ensure termination
const char *arg = strtok(boot.recovery, "\n");
if (arg != NULL && !strcmp(arg, "recovery")) {
*argv = (char **) malloc(sizeof(char *) * MAX_ARGS);
(*argv)[0] = strdup(arg);
for (*argc = 1; *argc < MAX_ARGS; ++*argc) {
if ((arg = strtok(NULL, "\n")) == NULL) break;
(*argv)[*argc] = strdup(arg);
}
LOGI("Got arguments from boot message\n");
} else if (boot.recovery[0] != 0 && boot.recovery[0] != 255) {
LOGE("Bad boot message\n\"%.20s\"\n", boot.recovery);
}
}
// --- if that doesn't work, try the command file
if (*argc <= 1) {
FILE *fp = fopen_path(COMMAND_FILE, "r");
if (fp != NULL) {
char *argv0 = (*argv)[0];
*argv = (char **) malloc(sizeof(char *) * MAX_ARGS);
(*argv)[0] = argv0; // use the same program name
char buf[MAX_ARG_LENGTH];
for (*argc = 1; *argc < MAX_ARGS; ++*argc) {
if (!fgets(buf, sizeof(buf), fp)) break;
(*argv)[*argc] = strdup(strtok(buf, "\r\n")); // Strip newline.
}
check_and_fclose(fp, COMMAND_FILE);
LOGI("Got arguments from %s\n", COMMAND_FILE);
}
}
// --> write the arguments we have back into the bootloader control block
// always boot into recovery after this (until finish_recovery() is called)
strlcpy(boot.command, "boot-recovery", sizeof(boot.command));
strlcpy(boot.recovery, "recovery\n", sizeof(boot.recovery));
int i;
for (i = 1; i < *argc; ++i) {
strlcat(boot.recovery, (*argv)[i], sizeof(boot.recovery));
strlcat(boot.recovery, "\n", sizeof(boot.recovery));
}
set_bootloader_message(&boot);
}
开发者ID:barneyzhu,项目名称:miui_recovery,代码行数:65,代码来源:recovery.c
示例16: blkdev_refresh
int blkdev_refresh(blkdev_t *blk)
{
int fd = 0;
char *devpath = NULL;
unsigned char *block = NULL;
int i, rc;
if (!(block = malloc(512)))
goto out;
/*
* Get the device size
*/
devpath = blkdev_get_devpath(blk);
if ((fd = open(devpath, O_RDONLY)) < 0) {
LOGE("Unable to open device '%s' (%s)", devpath, strerror(errno));
return -errno;
}
if (ioctl(fd, BLKGETSIZE, &blk->nr_sec)) {
LOGE("Unable to get device size (%s)", strerror(errno));
return -errno;
}
close(fd);
free(devpath);
/*
* Open the disk partition table
*/
devpath = blkdev_get_devpath(blk->disk);
if ((fd = open(devpath, O_RDONLY)) < 0) {
LOGE("Unable to open device '%s' (%s)", devpath,
strerror(errno));
free(devpath);
return -errno;
}
free(devpath);
if ((rc = read(fd, block, 512)) != 512) {
LOGE("Unable to read device partition table (%d, %s)",
rc, strerror(errno));
goto out;
}
/*
* If we're a disk, then process the partition table. Otherwise we're
* a partition so get the partition type
*/
if (blk->type == blkdev_disk) {
blk->nr_parts = 0;
if ((block[0x1fe] != 0x55) || (block[0x1ff] != 0xAA)) {
LOGI("Disk %d:%d does not contain a partition table",
blk->major, blk->minor);
goto out;
}
for (i = 0; i < NDOSPART; i++) {
struct dos_partition part;
dos_partition_dec(block + DOSPARTOFF + i * sizeof(struct dos_partition), &part);
if (part.dp_flag != 0 && part.dp_flag != 0x80) {
struct fat_boot_sector *fb = (struct fat_boot_sector *) &block[0];
if (!i && fb->reserved && fb->fats && fat_valid_media(fb->media)) {
LOGI("Detected FAT filesystem in partition table");
break;
} else {
LOGI("Partition table looks corrupt");
break;
}
}
if (part.dp_size != 0 && part.dp_typ != 0)
blk->nr_parts++;
}
} else if (blk->type == blkdev_partition) {
struct dos_partition part;
int part_no = blk->minor -1;
if (part_no < NDOSPART) {
dos_partition_dec(block + DOSPARTOFF + part_no * sizeof(struct dos_partition), &part);
blk->part_type = part.dp_typ;
} else {
LOGW("Skipping partition %d", part_no);
}
}
out:
if (block)
free(block);
char tmp[255];
char tmp2[32];
sprintf(tmp, "%s (blkdev %d:%d), %u secs (%u MB)",
(blk->type == blkdev_disk ? "Disk" : "Partition"),
blk->major, blk->minor,
//.........这里部分代码省略.........
开发者ID:pacificIT,项目名称:android_system_core,代码行数:101,代码来源:blkdev.c
示例17: LOGI
int
SiSTouch_Aegis_Multi_FOR_NEW_DRIVER::call_82_without_retry()
{
if( m_verbose)
{
LOGI("call_82()");
}
int ret = simple_io_master( 0x82, DELAY_FOR_GENEARL );
if ( ret < 0 )
{
ret = parse_syscall_return_value( ret, GENERAL_TYPE_FLAG );
}
else
{
ret = read_simple_ack_master(ret);
}
if( ret < 0 )
{
if ( m_verbose )
{
log_out_error_message( ret, 0x82 );
}
}
else
{
#ifdef VIA_IOCTL
#ifdef CLOSE_AFTER_RESET
sis_usb_start();
usleep(WAIT_DEVICE_REMOVE * 1000);
#endif
for(int i = 0; i < DEVICE_CLOSE_RETRY_TIMES; i++ )
{
ret = stop_driver();
// these three error not repeat retry in stop_driver()
if(ret != ERROR_ACCESS && ret != ERROR_ENTRY_NOT_EXIST && ret != ERROR_DEVICE_NOT_EXIST)
{
break;
}
/* re-find /dev/hidraw* if hidrawCnt changed ====================*/
if(reFindSisTouchName() == false)
{
}
/* ===========================================*/
usleep( DEVICE_CLOSE_RETRY_INTERVAL * 1000 );
}
#else
ret = stop_driver();
#endif
}
return ret;
}
开发者ID:jason10071,项目名称:ConsoleTool,代码行数:63,代码来源:SiSTouch_Aegis_Multi_For_New_Driver.cpp
示例18: create_and_build_program
cl_program create_and_build_program(const OCL_CONTEXT *ctx,
int count,
const char **strings,
const size_t *lengths,
int *err) {
cl_int status = CL_SUCCESS;
const char *opt = "-cl-fast-relaxed-math -cl-mad-enable";
cl_program program = clCreateProgramWithSource(
ctx->context, count,
strings, lengths, &status);
if (status != CL_SUCCESS) {
LOGE("There is some error in create program\n");
*err = -1;
return 0;
}
status = clBuildProgram(
program, 1, ctx->devices,
opt, NULL, NULL);
if (status != CL_SUCCESS) {
LOGE("Fail to build program, error: %d \n",status);
if (status == CL_BUILD_PROGRAM_FAILURE) {
char * build_log = NULL;
size_t build_log_size = 0;
cl_int logState = clGetProgramBuildInfo(
program, ctx->devices[0],
CL_PROGRAM_BUILD_LOG,
build_log_size, NULL,
&build_log_size);
if (logState != CL_SUCCESS) {
LOGE("Fail to get build log, error: %d\n", status);
*err = -1;
return 0;
}
build_log = (char *) malloc(build_log_size);
memset(build_log, '0', build_log_size);
logState = clGetProgramBuildInfo(
program, ctx->devices[0],
CL_PROGRAM_BUILD_LOG,
build_log_size,
build_log, NULL);
LOGI(" \n\t\t\tBUILD LOG\n");
LOGE(" ************************************************\n");
LOGI("%s\n", build_log);
LOGE(" ************************************************\n");
free(build_log);
}
*err = -1;
return 0;
}
*err = 0;
return program;
}
开发者ID:ShayanZafar,项目名称:Chromium-WebCL,代码行数:63,代码来源:ocl_wrapper.c
|
请发表评论