cm-kernel /drivers/net/wireless/tiwlan1251/CUDK/IPC/Linux/proc_main.c

Language C Lines 133
MD5 Hash 2a3d1adf5e78e56c6090ad5783bb0185 Estimated Cost $1,955 (why?)
Repository git://github.com/CyanogenMod/cm-kernel.git View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*******************************************************************************
**+--------------------------------------------------------------------------+**
**|                                                                          |**
**| Copyright 1998-2008 Texas Instruments, Inc. - http://www.ti.com/         |**
**|                                                                          |**
**| Licensed under the Apache License, Version 2.0 (the "License");          |**
**| you may not use this file except in compliance with the License.         |**
**| You may obtain a copy of the License at                                  |**
**|                                                                          |**
**|     http://www.apache.org/licenses/LICENSE-2.0                           |**
**|                                                                          |**
**| Unless required by applicable law or agreed to in writing, software      |**
**| distributed under the License is distributed on an "AS IS" BASIS,        |**
**| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |**
**| See the License for the specific language governing permissions and      |**
**| limitations under the License.                                           |**
**|                                                                          |**
**+--------------------------------------------------------------------------+**
*******************************************************************************/

/**************************************************************************/
/*                                                                        */
/* MODULE:  proc_main.c                                                 */
/* PURPOSE: Supplicant Initialization			                  */
/*	    		                                                  */
/**************************************************************************/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>

#include <fcntl.h>      /* for O_WRONLY*/

 #include <sys/time.h>
 #include <sys/resource.h>
 #include <unistd.h>

typedef unsigned int    UINT32;     /*nick*/

#include "osTIType.h"

#include "TI_SupplicantStub.h"
#include "TI_IPC_Api.h"
#include "ipc_event.h"



extern tiBOOL      g_bTerminate ;

int main(int argc, char ** argv)
{
#ifdef TI_DBG
    struct rlimit rLimit;

    rLimit.rlim_cur = 1024*1024;
    rLimit.rlim_max = 1024*1024;

    setrlimit(RLIMIT_CORE,&rLimit);
#endif

    FILE *f = fopen("/dev/console", "w" );
    int hfile_output = -1;
    if( !f )
        fprintf(stderr, "/dev/console open failed: %d(%s)\n", errno, strerror(errno) );
    else
    {
        if( dup2( f->_fileno, 1 ) == -1 )
        {
            fprintf(f, "dup2(hfile, 1) failed: %d(%s)\n", errno, strerror(errno) );
        }
        if( dup2( f->_fileno, 2 ) == -1 )
        {
            fprintf(f, "dup2(hfile, 2) failed: %d(%s)\n", errno, strerror(errno) );
        }
    }

    if( argc == 2 )
    {
        hfile_output = open((char *) argv[1], O_WRONLY );
        if( hfile_output == -1 )
        {
            perror((char *) argv[1]);
            goto exit;
        }
        if( dup2( 1, hfile_output ) == -1 )
        {
            fprintf(stderr, "dup2(1, hfile_output) failed: %d(%s)\n", errno, strerror(errno) );
        }
        if( dup2( 2, hfile_output ) == -1 )
        {
            fprintf(stderr, "dup2(2, hfile_output) failed: %d(%s)\n", errno, strerror(errno) );
        }
    }
    /* Open socket channel for CLI configuration */
    if(cnfg_open() != 0)
	{
        printf("\nCan't initialize configure socket\n");
        return -1;
    }

    if(IPC_Init())
    {
        printf("---main(): ERROR IPC init\n");

    }

    IPC_CONFIG_PARAMS *pRegistry_config = (IPC_CONFIG_PARAMS*)malloc(sizeof(IPC_CONFIG_PARAMS));

    pRegistry_config->F_ConfigNotification = SendDataStub;

    if(IPC_RegisterConfig((void*)pRegistry_config,
                                                sizeof(IPC_CONFIG_PARAMS)))
    {
        printf("---main(): ERROR registration CONFIG Messages\n");
    }
	free(pRegistry_config);


    for(;g_bTerminate != TRUE;)
    {
        usleep(1000000);     /* sleep 1 sec*/
    }
	
exit:
    if( f > 0 )
        fclose( f );
    if( hfile_output > 0 )
        close( hfile_output );
    return 0;
}
Back to Top