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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( p. S" q: X6 n( |' c
  1. [code]EDMA sample test application
      a% y/ F* q. y* i+ H& W
  2. /*9 k( A& N6 {0 U  ?, |/ Q
  3. * edma_test.c
    7 B2 N% ^2 a3 O/ L9 E$ \0 C5 I
  4. *) N) R" N8 m4 i. I( j6 T
  5. * brief  EDMA3 Test Application8 r, E9 }; B+ {7 Y0 _1 Y/ g
  6. *1 V# l- g* y% P
  7. *   This file contains EDMA3 Test code.
    0 `- I4 P7 V3 s3 K4 u
  8. *
    4 G7 h8 X8 k+ ]( s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; ^! o6 Z' L5 D1 p& D& h8 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" Y! ?$ u. I6 d
  11. *         TO CHANGE.' B9 \- N( y% S$ n, Y
  12. *
    0 G" z8 L* t% H5 ]+ U, m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ?7 \, X- w+ B2 j; s
  14. *$ M7 Z2 c7 W! ?9 |3 D0 s
  15. * This program is free software; you can redistribute it and/or
    / i8 \9 R' ?' j, X7 S
  16. * modify it under the terms of the GNU General Public License as+ a' ?5 t& z5 a' d8 I  x
  17. * published by the Free Software Foundation version 2.
    6 p1 j: U1 ]9 `. u# {9 B  \
  18. *: u( G, u  g5 J( |& k1 M% g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 I$ a9 G6 _. ^) O' w
  20. * kind, whether express or implied; without even the implied warranty
    7 w8 O2 Z& F$ }. U# u4 u) W0 w3 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' J- I4 N3 i8 O0 [: ?
  22. * GNU General Public License for more details.4 J5 z& D4 w+ Y4 j
  23. */
    5 X+ c- R# {6 u5 \2 N, o$ j

  24. 5 e& ^; D) p- m8 f7 R
  25. #include <linux/module.h>/ \. Q) I- T* C  d, C5 f( b0 Y8 O
  26. #include <linux/init.h>) S8 e4 r* g' }! k* O
  27. #include <linux/errno.h>
    # h* R3 V$ |3 I8 [; o
  28. #include <linux/types.h>
    % Q( Q& j  x; E
  29. #include <linux/interrupt.h>1 n5 q" A3 F7 P) ^3 K
  30. #include <asm/io.h>& D# Z& R, U5 P: c1 y" }
  31. #include <linux/moduleparam.h>
    1 p7 V1 @, h9 K6 O
  32. #include <linux/sysctl.h>4 C% u! |% J/ h- C
  33. #include <linux/mm.h>
    7 J3 {2 F* |8 P# r
  34. #include <linux/dma-mapping.h>
    ( P8 D% N& w! J2 W

  35. 3 U$ d8 v, I$ v) n4 w) v% |
  36. #include <mach/memory.h>% z+ _/ f5 {) r  K  c  h
  37. #include <mach/hardware.h>& x( i8 A5 c3 Q; G9 E* j
  38. #include <mach/irqs.h>
    7 o2 O" {( r( t+ E1 d& f
  39. #include <asm/hardware/edma.h>
    ; E; g, O( X% C

  40. 8 G$ V9 E$ c6 n/ I% C
  41. #undef EDMA3_DEBUG
    $ R: Z7 w6 g' t- S; m8 a/ L
  42. /*#define EDMA3_DEBUG*/6 Z; }$ L. b% ~! L/ A+ Y4 s4 b; X

  43. , b) N! i  I+ T( T/ t" j  s- h+ Y  R
  44. #ifdef EDMA3_DEBUG$ N4 v2 u" m) R( s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 V4 x* S$ [# A2 c4 d9 g- s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), a1 R2 p/ x2 P0 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ d" a% r" _# `
  48. #else
    ; f- H" f$ A3 j
  49. #define DMA_PRINTK( x... )- C, `' _7 R9 w& I$ z5 L
  50. #define DMA_FN_IN# d% G. l& ]! [; }
  51. #define DMA_FN_OUT
    , ]5 s. W8 A8 [3 L. ]
  52. #endif
    1 a% l4 c' r. ~3 G. X+ ^
  53. # N1 K$ r% ?7 _6 ^2 n" n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 Y' S6 V- b) R
  55. #define STATIC_SHIFT                3
      x( n2 \" H7 y, B4 m9 X
  56. #define TCINTEN_SHIFT               20* I8 I& k9 g5 g" b- J/ W8 B% {
  57. #define ITCINTEN_SHIFT              218 U& J( w# n3 W" \. I
  58. #define TCCHEN_SHIFT                22
    ( a1 u0 O3 ~8 S5 m
  59. #define ITCCHEN_SHIFT               23. \* r+ @% t1 G1 c

  60. $ I# q6 d3 F: X' ^) P# c4 Q
  61. static volatile int irqraised1 = 0;/ i1 P3 k- }) N. D$ R; J
  62. static volatile int irqraised2 = 0;
    " i# ~+ [4 d" f! M

  63. * c8 j. Z# x  ~: q6 q  x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 u0 O7 ?) H! k3 R/ S4 w* r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % E$ p1 b$ d  u. ~. t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : f1 \% ?- |( K( H% k$ o$ v3 i
  67. + L& X* {! z; @1 O2 u
  68. dma_addr_t dmaphyssrc1 = 0;
    1 w3 Q: \- t$ N* P7 F
  69. dma_addr_t dmaphyssrc2 = 0;
    . V! n$ E  |' x5 H# ]. m
  70. dma_addr_t dmaphysdest1 = 0;
      q! e1 `7 M' k6 \+ W* C: V
  71. dma_addr_t dmaphysdest2 = 0;4 r, \! I9 r3 ^9 \

  72. . B) X# U8 i  x
  73. char *dmabufsrc1 = NULL;* y, m* h- c$ t2 r( W, B+ e
  74. char *dmabufsrc2 = NULL;3 \# x7 O6 _7 V; X4 a% c9 U' r
  75. char *dmabufdest1 = NULL;8 E6 W3 x1 y' C5 p8 \  u9 J5 W
  76. char *dmabufdest2 = NULL;
    3 G; t  q1 n* `0 N; h" P

  77. ( h. g. M5 q" S/ l  ?
  78. static int acnt = 512;1 P; `# ^8 o- X" T
  79. static int bcnt = 8;
    $ j5 D  U6 t: x
  80. static int ccnt = 8;
    4 X8 ?8 U% {! R- f* X; R

  81. " y8 n# B) u1 F1 @
  82. module_param(acnt, int, S_IRUGO);# a# G0 [& z, D. f
  83. module_param(bcnt, int, S_IRUGO);
    7 g9 r* V+ q& l. z. E5 R3 Y7 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) v, r/ s" M2 {3 w6 @

3 ]( h* w. _- S& N: e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# a% n6 o5 |8 L* |4 ~1 b5 T. P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 a' t) i# F2 ^, i7 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( o/ J5 W. {) P7 z# C1 W' o

; [% V3 Y* D$ U7 y/ q6 e. @+ z# q2 a: T( ^( F, u" S1 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 04:24 , Processed in 0.046891 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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