View difference between Paste ID: yAry4RD5 and rh3yVjww
SHOW: | | - or go back to the newest paste.
1
<< uart.comp >>
2
extra_setup = yes;
3
...
4
variable char *name; // UART name
5
...
6
;;
7
8
char *uart_chans[18] = {0,};
9
RTAPI_MP_ARRAY_STRING(uart_chans, 16, "BSPI Channel names");
10
...
11
EXTRA_SETUP(){
12
    name = uart_chans[extra_arg];
13
    HM2_ERR_NO_LL("uart name = %s\n", name);
14
    hm2_uart_setup(name, 115000);
15
    return 0;
16
}
17
18
<< hm2_uart_setup >>
19
20
21
EXPORT_SYMBOL_GPL(hm2_uart_setup);
22
int hm2_uart_setup(char *name, int bitrate){
23
    hostmot2_t *hm2;
24
    hm2_uart_instance_t *inst = 0;
25
    float clock_low;
26
    u32 buff;
27
    int i,r;
28
    
29
    HM2_ERR_NO_LL("name seems to be %s\n", name);
30
    
31
    i = hm2_get_uart(&hm2, name);
32
    if (i < 0){
33
        HM2_ERR_NO_LL("Can not find UART instance %s.\n", name);
34
        return -1;
35
    }
36
    *inst = hm2->uart.instance[i];
37
38
39
<< hostmot2.c >>
40
41
EXPORT_SYMBOL_GPL(hm2_get_uart);
42
int hm2_get_uart(hostmot2_t** hm2, char *name){
43
    struct list_head *ptr;
44
    int i;
45
    list_for_each(ptr, &hm2_list) {
46
        *hm2 = list_entry(ptr, hostmot2_t, list);
47
        if ((*hm2)->uart.num_instances > 0) {
48
            for (i = 0; i <= (*hm2)->uart.num_instances ; i++) {
49
                if (!strcmp((*hm2)->uart.instance[i].name, name)) {return i;}
50
            }
51
        }
52
    }
53
    return -1;
54
}
55
56
<< And the dmesg…>>
57
58
[ 1329.462501] hm2/hm2_5i23.0: registered
59
[ 1329.462507] hm2_5i23.0: initialized AnyIO board at 0000:05:00.0
60
[ 1329.470433] hm2: uart name = hm2_5i23.0.uart.0
61
[ 1329.470443] hm2: name seems to be hm2_5i23.0.uart.0
62
[ 1329.470473] BUG: unable to handle kernel NULL pointer dereference at (null)
63
[ 1329.470484] IP: [<fa0bd4d3>] hm2_uart_setup+0x79/0x146 [hostmot2]
64
[ 1329.470502] *pde = 253de067 *pte = 00000000 
65
[ 1329.470511] Oops: 0002 [#1] SMP 
66
[ 1329.470518] last sysfs file: /sys/devices/hm2_5i23.0/firmware/hm2_5i23.0/loading
67
[ 1329.470525] Modules linked in: mesa_uart(+) hm2_pci hostmot2 threads hal_lib rtapi rtai_math rtai_sem rtai_fifos rtai_sched rtai_hal binfmt_misc nfsd exportfs snd_hda_codec_realtek nfs lockd nfs_acl snd_hda_intel auth_rpcgss snd_hda_codec sunrpc snd_hwdep snd_pcm_oss snd_mixer_oss fbcon tileblit font bitblit softcursor snd_pcm vga16fb vgastate snd_seq_dummy snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event snd_seq snd_timer snd_seq_device w83627hf hwmon_vid i915 coretemp drm_kms_helper joydev snd ppdev usbhid drm lp soundcore usbtouchscreen parport_pc i2c_algo_bit video hid psmouse serio_raw parport snd_page_alloc intel_agp output agpgart r8169 mii [last unloaded: rtai_hal]
68
[ 1329.470644] 
69
[ 1329.470652] Pid: 7859, comm: insmod Not tainted (2.6.32-122-rtai #rtai)         
70
[ 1329.470659] EIP: 0060:[<fa0bd4d3>] EFLAGS: 00010246 CPU: 0
71
[ 1329.470669] EIP is at hm2_uart_setup+0x79/0x146 [hostmot2]
72
[ 1329.470676] EAX: 00000001 EBX: e51c0680 ECX: 00000023 EDX: 00000000
73
[ 1329.470682] ESI: fa03c560 EDI: 00000000 EBP: e53c1ed4 ESP: e53c1e98
74
[ 1329.470688]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
75
[ 1329.470695] Process insmod (pid: 7859, ti=e53c0000 task=f5ff8000 task.ti=e53c0000)
76
[ 1329.470700] I-pipe domain Linux
77
[ 1329.470704] Stack:
78
[ 1329.470708]  00000001 fa0c6bd7 e51c0680 e53c1f4b 0001c138 f0959000 00000014 e53c1f22
79
[ 1329.470724] <0> e53c1ed4 fa02d92f e53c1f22 f0959000 fa03ce70 e53c1f22 fa03ce84 e53c1f5c
80
[ 1329.470740] <0> fa12c0d6 00000001 fa12c34f e51c0680 00000000 3c653cc8 00000001 00000000
81
[ 1329.470757] Call Trace:
82
[ 1329.470770]  [<fa02d92f>] ? hal_malloc+0x3e/0x74 [hal_lib]
83
[ 1329.470794]  [<fa12c0d6>] ? init_module+0xc2/0x255 [mesa_uart]
84
[ 1329.470808]  [<c019f706>] ? ring_buffer_time_stamp+0x6/0x10
85
[ 1329.470817]  [<c01a48de>] ? ftrace_now+0x2e/0x50
86
[ 1329.470826]  [<c019b157>] ? tracepoint_module_notify+0x27/0x30
87
[ 1329.470836]  [<c056c373>] ? notifier_call_chain+0x43/0x60
88
[ 1329.470845]  [<c0101041>] ? do_one_initcall+0x31/0x1b0
89
[ 1329.470855]  [<fa12c014>] ? init_module+0x0/0x255 [mesa_uart]
90
[ 1329.470866]  [<c0179781>] ? sys_init_module+0xb1/0x220
91
[ 1329.470874]  [<c010340d>] ? syscall_call+0x7/0xb
92
[ 1329.470879] Code: e8 5b f7 f4 ff e9 d6 00 00 00 8b 54 24 2c 69 f0 8c 00 00 00 31 c0 89 c7 b9 23 00 00 00 b0 01 89 54 24 14 03 b2 9c 07 00 00 31 d2 <f3> a5 f7 35 00 00 00 00 31 d2 89 54 24 20 d9 7c 24 1a db 44 24 
93
[ 1329.470970] EIP: [<fa0bd4d3>] hm2_uart_setup+0x79/0x146 [hostmot2] SS:ESP 0068:e53c1e98
94
[ 1329.470985] CR2: 0000000000000000
95
[ 1329.470992] ---[ end trace 58b595c30e337326 ]---