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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ^5 w' R' q% L7 t# I& P
  1. [code]EDMA sample test application' h, Z6 _% B  b7 d
  2. /*
    - a, I0 \) w" P1 g; X8 g
  3. * edma_test.c
    ; N0 O( \9 d" H
  4. ** ^7 E7 y* C) V% C" u: \1 g' T
  5. * brief  EDMA3 Test Application! D4 @, `' D4 n  ^' Q. R
  6. *" u: c* X/ `- S& j( j* Q
  7. *   This file contains EDMA3 Test code.
    , j& k9 z2 Q; z  w  q2 X
  8. *
    " n; ]) W$ H) P: M* `- Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; D4 y" o! {( r6 b1 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; X4 U- x0 @  ?! e
  11. *         TO CHANGE.3 y5 [& n: F6 F$ E6 |* I1 r* k5 D
  12. *
    ) N5 N) o: T5 q0 c, V) ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 ^9 @7 A- d' D
  14. *! x! s$ X9 s' I4 m; p0 u
  15. * This program is free software; you can redistribute it and/or3 K& c, v4 b4 J6 _9 z$ D* P
  16. * modify it under the terms of the GNU General Public License as; U' F& x. n: Q2 `: ^( f) E
  17. * published by the Free Software Foundation version 2.
    6 }: h. r! s! P* o
  18. *, d/ e' T- O3 l2 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 [% Y) h) X. J: I. \& T& Z
  20. * kind, whether express or implied; without even the implied warranty
    - i8 F) @5 ]0 v( ]3 f- K2 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & m- R  ]# ?% w( B
  22. * GNU General Public License for more details.) ^, G( |& z5 D4 q, W2 s
  23. */
    0 E+ e+ I1 x* O( `. ~1 F$ Y+ {* L

  24. ; S9 L4 \/ w4 n* [# c, C; i3 `
  25. #include <linux/module.h>" v+ f8 Z; N" M% M* z! a
  26. #include <linux/init.h># x" N8 H7 y. o
  27. #include <linux/errno.h>
    6 i: v" D. @+ F# l) G- ], r
  28. #include <linux/types.h>! }$ G9 v" e  m9 _
  29. #include <linux/interrupt.h>
    ( b4 |, W; g5 ^1 O
  30. #include <asm/io.h>
      `1 L# f+ z/ f& R5 b# Z) S/ L$ u0 ~
  31. #include <linux/moduleparam.h>
    ( Z- n+ q+ K! Q! l! r, o) @; K) \8 y) ]* ?: U
  32. #include <linux/sysctl.h>
    3 x7 J* h$ C$ L4 Q8 G  J
  33. #include <linux/mm.h>
    % @0 ?, @, C2 [, E4 A" P( Q9 ~
  34. #include <linux/dma-mapping.h>
    6 z& T8 }  _9 @9 v- b% o
  35. 4 v, Z5 `! H; i- {* I  I& d
  36. #include <mach/memory.h>
    ) B( b+ Z* ]" h6 i
  37. #include <mach/hardware.h># d4 I8 Z0 Q6 D; Y% }7 Z
  38. #include <mach/irqs.h>& z! w5 E# {0 d9 b& a$ H/ [
  39. #include <asm/hardware/edma.h>) Y' F, j9 T' E# N5 h6 ~

  40. " G1 f6 q( c+ `& i
  41. #undef EDMA3_DEBUG4 Q1 z& y+ b5 x/ k9 K1 \8 |
  42. /*#define EDMA3_DEBUG*/# h  s* }7 R5 \: L- G% M% c5 _/ d

  43. ) Z2 b. T" K, R
  44. #ifdef EDMA3_DEBUG! t, c! a5 R: P, i" j( s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- X* j* j. b1 i! t9 R/ e( T) u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + O$ x  W" _5 ?( ~, C/ Z( t/ g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 h: x6 u' f! o+ O# w1 H- Y) L! n6 f7 i
  48. #else+ i; ?& d' m9 Q& s. y. R: s# A8 s
  49. #define DMA_PRINTK( x... ). {* R; l2 T; R. o
  50. #define DMA_FN_IN+ I; C. C/ ~3 M: A( X
  51. #define DMA_FN_OUT
    ( M; q9 S) E' i; k% H
  52. #endif! W8 i5 _. e/ O. C; e' c
  53. ! D8 R; y9 E# u, s8 [/ J- h, s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( ]9 X- W: q1 t0 m* v( j+ W5 g3 d
  55. #define STATIC_SHIFT                3: F  E  \/ J- v
  56. #define TCINTEN_SHIFT               20
    ! p$ z7 ]# K0 ]* G# x9 ?, T
  57. #define ITCINTEN_SHIFT              21% U, k/ Z9 e9 T5 I- @4 e
  58. #define TCCHEN_SHIFT                22
    / ]% l: i( U  y
  59. #define ITCCHEN_SHIFT               23
    7 i5 r' s; `  P- ^$ \5 w
  60. ! u  J6 F1 I- j' M
  61. static volatile int irqraised1 = 0;
    8 b) V1 d+ F, ?; O' A# c9 l+ l
  62. static volatile int irqraised2 = 0;
    2 Y2 i9 c* }$ ^( I4 d
  63. ; R' v! ?5 h" o9 Y! y5 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 k/ V4 Z& M  |2 d/ d0 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k) t7 t8 ?/ d- D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 T+ o2 C0 S' n

  67. . i0 b5 O3 f; `! j- w- ]
  68. dma_addr_t dmaphyssrc1 = 0;" p4 i# V, l7 G. D
  69. dma_addr_t dmaphyssrc2 = 0;
    ; O7 o. ^; T' r9 s7 v' Q1 u
  70. dma_addr_t dmaphysdest1 = 0;
    ! O2 N+ ^6 a, I1 E; S
  71. dma_addr_t dmaphysdest2 = 0;& u! q" q+ J4 y& o1 X
  72.   O0 k6 i8 w. u3 T3 A6 s8 r
  73. char *dmabufsrc1 = NULL;9 r' }% c. F2 j4 r
  74. char *dmabufsrc2 = NULL;. f8 n; }! R; x+ l
  75. char *dmabufdest1 = NULL;0 f1 ?5 R( m) x! k
  76. char *dmabufdest2 = NULL;$ K% h0 q& H4 `3 b0 t  X/ D
  77. " y$ N+ R+ F( @( j  X2 b& ]
  78. static int acnt = 512;  m- r; i" ^2 Q
  79. static int bcnt = 8;8 Q3 T% O7 [9 s4 P4 o1 _
  80. static int ccnt = 8;% Q) Q! `* G. H2 B3 C
  81. 4 g* D) A! r3 |( |& }9 ?
  82. module_param(acnt, int, S_IRUGO);
    ; w  Z# X# @3 z) ]# m
  83. module_param(bcnt, int, S_IRUGO);! o# ]+ M& s0 a1 X8 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" _( T" H7 \, o; s! l/ D6 y
* E# t9 V' f5 }$ U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 C5 R+ D/ z; H  W! A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 t) c6 W! v% t2 D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ ~6 y4 A' |7 n$ s& Y7 q
9 [8 w! }5 V: ~5 P/ j) x! k- Q0 G) Y" R; ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 06:52 , Processed in 0.040341 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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