Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- << uart.comp >>
- extra_setup = yes;
- ...
- variable char *name; // UART name
- ...
- ;;
- char *uart_chans[18] = {0,};
- RTAPI_MP_ARRAY_STRING(uart_chans, 16, "BSPI Channel names");
- ...
- EXTRA_SETUP(){
- name = uart_chans[extra_arg];
- HM2_ERR_NO_LL("uart name = %s\n", name);
- hm2_uart_setup(name, 115000);
- return 0;
- }
- << hm2_uart_setup >>
- EXPORT_SYMBOL_GPL(hm2_uart_setup);
- int hm2_uart_setup(char *name, int bitrate){
- hostmot2_t *hm2;
- hm2_uart_instance_t *inst = 0;
- float clock_low;
- u32 buff;
- int i,r;
- HM2_ERR_NO_LL("name seems to be %s\n", name);
- i = hm2_get_uart(&hm2, name);
- if (i < 0){
- HM2_ERR_NO_LL("Can not find UART instance %s.\n", name);
- return -1;
- }
- *inst = hm2->uart.instance[i];
- clock_low = 1 / inst->clock_freq;
- buff = (u32)((float)bitrate/(1048576.0 * clock_low)); //20 bits in this version
- if (buff != inst->bitrate){
- r = hm2->llio->write(hm2->llio, inst->rx_bitrate_addr, &buff, sizeof(u32));
- r += hm2->llio->write(hm2->llio, inst->tx_bitrate_addr, &buff, sizeof(u32));
- if (r < 0) {
- HM2_ERR("UART: hm2->llio->write failure %s\n", name);
- return -1;
- }
- inst->bitrate = buff;
- }
- return 0;
- }
- << hostmot2.c >>
- EXPORT_SYMBOL_GPL(hm2_get_uart);
- int hm2_get_uart(hostmot2_t** hm2, char *name){
- struct list_head *ptr;
- int i;
- list_for_each(ptr, &hm2_list) {
- *hm2 = list_entry(ptr, hostmot2_t, list);
- if ((*hm2)->uart.num_instances > 0) {
- for (i = 0; i <= (*hm2)->uart.num_instances ; i++) {
- if (!strcmp((*hm2)->uart.instance[i].name, name)) {return i;}
- }
- }
- }
- return -1;
- }
- << And the dmesg…>>
- [ 1329.462501] hm2/hm2_5i23.0: registered
- [ 1329.462507] hm2_5i23.0: initialized AnyIO board at 0000:05:00.0
- [ 1329.470433] hm2: uart name = hm2_5i23.0.uart.0
- [ 1329.470443] hm2: name seems to be hm2_5i23.0.uart.0
- [ 1329.470473] BUG: unable to handle kernel NULL pointer dereference at (null)
- [ 1329.470484] IP: [<fa0bd4d3>] hm2_uart_setup+0x79/0x146 [hostmot2]
- [ 1329.470502] *pde = 253de067 *pte = 00000000
- [ 1329.470511] Oops: 0002 [#1] SMP
- [ 1329.470518] last sysfs file: /sys/devices/hm2_5i23.0/firmware/hm2_5i23.0/loading
- [ 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]
- [ 1329.470644]
- [ 1329.470652] Pid: 7859, comm: insmod Not tainted (2.6.32-122-rtai #rtai)
- [ 1329.470659] EIP: 0060:[<fa0bd4d3>] EFLAGS: 00010246 CPU: 0
- [ 1329.470669] EIP is at hm2_uart_setup+0x79/0x146 [hostmot2]
- [ 1329.470676] EAX: 00000001 EBX: e51c0680 ECX: 00000023 EDX: 00000000
- [ 1329.470682] ESI: fa03c560 EDI: 00000000 EBP: e53c1ed4 ESP: e53c1e98
- [ 1329.470688] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
- [ 1329.470695] Process insmod (pid: 7859, ti=e53c0000 task=f5ff8000 task.ti=e53c0000)
- [ 1329.470700] I-pipe domain Linux
- [ 1329.470704] Stack:
- [ 1329.470708] 00000001 fa0c6bd7 e51c0680 e53c1f4b 0001c138 f0959000 00000014 e53c1f22
- [ 1329.470724] <0> e53c1ed4 fa02d92f e53c1f22 f0959000 fa03ce70 e53c1f22 fa03ce84 e53c1f5c
- [ 1329.470740] <0> fa12c0d6 00000001 fa12c34f e51c0680 00000000 3c653cc8 00000001 00000000
- [ 1329.470757] Call Trace:
- [ 1329.470770] [<fa02d92f>] ? hal_malloc+0x3e/0x74 [hal_lib]
- [ 1329.470794] [<fa12c0d6>] ? init_module+0xc2/0x255 [mesa_uart]
- [ 1329.470808] [<c019f706>] ? ring_buffer_time_stamp+0x6/0x10
- [ 1329.470817] [<c01a48de>] ? ftrace_now+0x2e/0x50
- [ 1329.470826] [<c019b157>] ? tracepoint_module_notify+0x27/0x30
- [ 1329.470836] [<c056c373>] ? notifier_call_chain+0x43/0x60
- [ 1329.470845] [<c0101041>] ? do_one_initcall+0x31/0x1b0
- [ 1329.470855] [<fa12c014>] ? init_module+0x0/0x255 [mesa_uart]
- [ 1329.470866] [<c0179781>] ? sys_init_module+0xb1/0x220
- [ 1329.470874] [<c010340d>] ? syscall_call+0x7/0xb
- [ 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
- [ 1329.470970] EIP: [<fa0bd4d3>] hm2_uart_setup+0x79/0x146 [hostmot2] SS:ESP 0068:e53c1e98
- [ 1329.470985] CR2: 0000000000000000
- [ 1329.470992] ---[ end trace 58b595c30e337326 ]---
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement