OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12119|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, H- j, B; A: R8 h2 E  J
  1. [code]EDMA sample test application# U; f8 s0 o' y
  2. /*
    % j! J0 P2 o( q/ K* |& G1 C
  3. * edma_test.c; n% r  J% U1 @8 a; h0 [+ \3 p
  4. *9 n9 Z% x" y  z2 F0 C
  5. * brief  EDMA3 Test Application# K) K4 e0 c3 Z+ L
  6. *
    ( q8 G7 ^3 S$ F5 A  w$ x7 U! f3 e* v
  7. *   This file contains EDMA3 Test code.
    8 \8 d; f, B' V2 p( O7 H% q/ Q1 D
  8. *, W* Q6 s2 V7 I% k! J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + \! S2 |! ?+ |( Y, P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* v4 P8 ~6 C, M4 ]! Y/ r2 B
  11. *         TO CHANGE.
    / u$ ]0 k% @0 Y- S0 b
  12. *
    3 C" Z6 Q% _, O4 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ q$ p" z  V% V/ \
  14. *0 g' b* l. g+ Y% H4 h9 S5 d
  15. * This program is free software; you can redistribute it and/or, B9 y- P& `4 I/ I$ w8 F
  16. * modify it under the terms of the GNU General Public License as0 ?- W! l4 t" F6 H4 f( @
  17. * published by the Free Software Foundation version 2.
    ; f  t6 o6 e3 w2 r
  18. *
    7 l+ g- D' a1 x! h: y" l# X  ?, a2 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 d$ h- p7 {- V8 }; i
  20. * kind, whether express or implied; without even the implied warranty' z% p; X9 W: f, r# y8 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& w7 A( ~& n1 B& n& C4 X
  22. * GNU General Public License for more details.
      B* Z1 p$ q# ^/ Y$ O4 t, ?( c3 P
  23. *// v( f* P( Y2 S) }% [' V
  24. % E. R7 a- v( I& X1 k/ v2 r6 l0 U
  25. #include <linux/module.h>
    6 b: @/ a# {8 s% d
  26. #include <linux/init.h>
    * i' k: G0 n9 @3 D, j
  27. #include <linux/errno.h>( [$ h. h* m7 l1 y) S* E
  28. #include <linux/types.h>, g, c- d% O. i2 q  P
  29. #include <linux/interrupt.h>
    / _! ]2 Z' Q% l  S
  30. #include <asm/io.h>
    . `' r( [9 Q! t2 F1 q
  31. #include <linux/moduleparam.h>
    2 y2 N1 T" x) G8 P! Q0 v
  32. #include <linux/sysctl.h>
    - V/ M; f9 X5 Q- I, [- T
  33. #include <linux/mm.h>! k" V6 E  F, _  ?1 t
  34. #include <linux/dma-mapping.h>
    - V: o! X( ]# a" Q

  35. % E4 d- r9 b! i- h& @7 A
  36. #include <mach/memory.h>
    8 y+ Z( Q/ ?( h; k# I3 L; I; c' O
  37. #include <mach/hardware.h>
    5 p) k* a! L5 R# L6 X$ m
  38. #include <mach/irqs.h>% {9 e5 q# ^6 J
  39. #include <asm/hardware/edma.h>
    3 V! F! `; c2 ~

  40. 5 z: L  {+ Q: s4 U) X& [/ a
  41. #undef EDMA3_DEBUG
    . I* r4 O5 \6 l( j7 D! q- j
  42. /*#define EDMA3_DEBUG*/- E6 B* c/ g5 }2 m9 c6 m+ e+ t

  43. + j# v- o1 _" T+ |% q, h
  44. #ifdef EDMA3_DEBUG) J/ K7 Z# Y8 b0 Z8 ~3 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- E5 R7 B+ V8 h: M" o: f5 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & l0 w% z, Z, h) R0 W. k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& I$ N6 C! O6 E7 i7 M$ g' ^+ O; y
  48. #else
    ! ~3 O* |0 e4 `4 O  ~4 p8 U6 i
  49. #define DMA_PRINTK( x... )
    0 a0 i% @, x) N
  50. #define DMA_FN_IN
    - |, Y. R2 ~. w0 Y: _; H  I$ j
  51. #define DMA_FN_OUT4 m4 E; c* t  X' ^- {" K" W6 X% ]
  52. #endif, N+ z2 p/ `% z6 k5 Y! R
  53. ; B* c4 B4 o9 G; @5 N/ I4 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); a8 Y, u; }, {8 {4 l+ t% H+ q1 y
  55. #define STATIC_SHIFT                3( x' Z2 y5 L3 d
  56. #define TCINTEN_SHIFT               206 w. ?) r* T: E# ]  U4 V5 e
  57. #define ITCINTEN_SHIFT              210 |4 o+ J+ ^& \1 U( J
  58. #define TCCHEN_SHIFT                22
    2 l/ X! |! G' R" W( M/ k. A
  59. #define ITCCHEN_SHIFT               23
    : Z0 F; r1 o& k3 Q

  60. 4 Q- U& _: A& ^& N. J! x
  61. static volatile int irqraised1 = 0;2 J7 @/ r5 E* {& [1 H& V" T9 T
  62. static volatile int irqraised2 = 0;
    5 A2 q5 z0 V5 Z/ M4 I
  63. " [' w; @6 ?2 L- Y, Q. w4 P* ?$ m! P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 g4 b# D) }# E9 R6 {  p) X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I  ]8 h! r0 H/ Q& z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 z; L+ n: J0 J0 X! A9 Z

  67. * G% f8 E# `' `9 X7 X4 g* G& R
  68. dma_addr_t dmaphyssrc1 = 0;  N* w( x* d' d1 y; }8 a, y
  69. dma_addr_t dmaphyssrc2 = 0;
    ) O6 K9 m: x, R5 s9 y: S
  70. dma_addr_t dmaphysdest1 = 0;
    1 J1 v3 O1 m1 ^' s* P
  71. dma_addr_t dmaphysdest2 = 0;
    * W+ f1 D& k, [3 ]
  72. + y& J; R$ B% M  D3 {0 Z
  73. char *dmabufsrc1 = NULL;
    ) W- W) V0 @; x
  74. char *dmabufsrc2 = NULL;
    # h5 J7 U0 m* p' `/ T" A
  75. char *dmabufdest1 = NULL;
    + [$ s' w2 [) {5 I1 I0 _; D3 `
  76. char *dmabufdest2 = NULL;, \/ i  O0 W" u

  77.   t( H/ o  f0 }! k! c% m1 e
  78. static int acnt = 512;* n) d6 t' |, W8 _: h" q- [4 t2 g) H
  79. static int bcnt = 8;  B5 N6 L$ `' q, i# E
  80. static int ccnt = 8;- t/ l* E, W0 H( n- W+ g" M* Z! h

  81. " U  C1 N' m& t1 D3 y: o6 R
  82. module_param(acnt, int, S_IRUGO);
      g3 i5 ]. Z2 A
  83. module_param(bcnt, int, S_IRUGO);6 q6 `, n" A' B% }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 f  y" b+ ]7 s: z0 P

" j* i. T" H1 O: |) r7 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 v* F+ c" U# e! ~* T" \/ V9 }$ I
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 D0 F! r/ C6 U; L/ {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; m- T. e1 i& Z
$ U7 K# ^$ F! Y9 e- d* l

' E( m& h2 @* X1 t" j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-3-3 02:47 , Processed in 0.044701 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表