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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) @- \( z! A5 v
  1. [code]EDMA sample test application
    ( n% n# z0 Q- P. X
  2. /*' |! L! c, Y2 ?
  3. * edma_test.c
      }* r9 \4 j0 `/ F- m& E
  4. *
    # @1 H5 W- i; f* ~6 \; R# |. g
  5. * brief  EDMA3 Test Application
    1 B4 o2 D. F0 B$ W. |
  6. *. e$ C8 w0 ^8 {# W. v4 |4 o
  7. *   This file contains EDMA3 Test code.
    ! L; J* \( E. y1 b% z
  8. *, |* u; f% D, A* u1 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - o* N  `: c* t3 A% s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - Z( x% M- ]% ?* b; p
  11. *         TO CHANGE.. ^+ ]" z# N) n
  12. *+ _. O: k; s7 D* t; ]$ I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; b# b0 Q$ W# h
  14. *1 z! T/ D1 a: x$ l% F" d2 w5 s
  15. * This program is free software; you can redistribute it and/or
    . `* @! G" j, L* L9 p7 X8 t4 T  {$ K
  16. * modify it under the terms of the GNU General Public License as
    6 Y. w5 x' i- G( F! D, j, H
  17. * published by the Free Software Foundation version 2.
    2 j# G7 l1 U3 a: f: |
  18. *. u9 ?4 s& [+ h5 m" U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ]; G$ I, S/ r% D+ l, m
  20. * kind, whether express or implied; without even the implied warranty5 ^( E/ ?/ y" ^; x4 B& b% t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 D1 ?1 I0 Z. {( Z3 x
  22. * GNU General Public License for more details.
    ; x# _* l/ V+ {! D* X
  23. *// }" S5 Q0 Z: V
  24. 5 i% i- k6 ^) @1 ^% }4 t
  25. #include <linux/module.h>1 G! f9 `& t# E0 {: {: [" V
  26. #include <linux/init.h>
    ) W. Y( R. o9 @* {( p% E
  27. #include <linux/errno.h>9 F' Y; r# e; X4 B! B3 \! r4 B" {
  28. #include <linux/types.h>
    4 p5 r, E' Q" r2 s' N
  29. #include <linux/interrupt.h>
    : z% l8 t7 I1 X, P8 k- ~
  30. #include <asm/io.h>9 D2 ~. ]: B/ N% [5 i; _8 ]
  31. #include <linux/moduleparam.h>
    3 ?! h$ G, M( A: t1 g4 N
  32. #include <linux/sysctl.h>0 z& k+ B, s+ n; Y: @) J
  33. #include <linux/mm.h>
    - e8 s1 _4 k8 e; _. F. F$ G7 s
  34. #include <linux/dma-mapping.h>
      }' ?/ }% G: A

  35. , f  `: U& l* d$ c! t. I; I
  36. #include <mach/memory.h>& K' D) i5 C: u- y+ k
  37. #include <mach/hardware.h>) z; ?, L+ {# ^% O
  38. #include <mach/irqs.h>
    . F9 R( k9 F* i" e& }! q
  39. #include <asm/hardware/edma.h>% x' h. x* b9 t. R4 ^
  40.   C8 Q( `( v. b( _0 N
  41. #undef EDMA3_DEBUG
      B  U: |9 p7 `! d& L* ]- I1 m9 l
  42. /*#define EDMA3_DEBUG*/
    0 a& L3 i; S3 p  z& v. o
  43. ( K5 U7 j4 @7 @& Y0 h
  44. #ifdef EDMA3_DEBUG
    + y2 K2 d$ s* W' k& x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % n8 O3 c7 `7 w+ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" v9 G4 S$ E( l9 k" U! X9 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & G" c8 N# S% c) z, y0 _2 K# i
  48. #else# k2 ?+ R- c: \9 J
  49. #define DMA_PRINTK( x... )
    $ w& i) j9 ]: h" p) m: Q' @
  50. #define DMA_FN_IN
    - W1 e* I; ?6 }) w
  51. #define DMA_FN_OUT4 x: K! K2 n2 f3 S7 Z
  52. #endif
    1 {% A5 z2 f' Z" C) p
  53. " P# B$ Z5 D, A8 }, H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) E0 V- A$ Y6 e" F  ?
  55. #define STATIC_SHIFT                3
    : a4 {) `! ^: |
  56. #define TCINTEN_SHIFT               20
    - k% u1 |/ I* o. ^2 }8 O
  57. #define ITCINTEN_SHIFT              21
    / I$ t0 u; p! c3 C& ~& E0 m
  58. #define TCCHEN_SHIFT                22
      t& b: {2 x; E) ^. {' T
  59. #define ITCCHEN_SHIFT               23$ q% \) K+ A; e  ?3 K7 f+ H
  60. $ y6 v" H* i5 \0 _
  61. static volatile int irqraised1 = 0;
    : L, M2 G" _2 f
  62. static volatile int irqraised2 = 0;
    0 j8 c( B, B% i- M# z

  63. 4 ?( I) x6 u: g9 ?8 g7 v# g& U* F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + v1 C, ^4 @6 D' w( m, U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& E) q# b: h" T3 U% f4 q# ^, f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ `+ h  b( m- G2 ?1 c
  67. / Y, P) r' A; S: U- k9 q- i% S
  68. dma_addr_t dmaphyssrc1 = 0;
    * @8 t5 m$ G, O% B( b. v! O1 `7 _
  69. dma_addr_t dmaphyssrc2 = 0;
    , O  \6 b7 R1 r9 z6 [& U
  70. dma_addr_t dmaphysdest1 = 0;
    5 n/ K+ P3 K; S7 D* }
  71. dma_addr_t dmaphysdest2 = 0;
    * `2 N4 s# y; y  G, h
  72. # a1 u- c. j4 Z: H1 R' Y) i
  73. char *dmabufsrc1 = NULL;( q: ]3 Y* I" S8 ?
  74. char *dmabufsrc2 = NULL;# r1 e8 c1 ]# F
  75. char *dmabufdest1 = NULL;
    * G; k. ~& r7 L& c! r! j
  76. char *dmabufdest2 = NULL;6 B% U( U7 h0 {0 D8 |
  77. 8 A8 U% \* k7 o
  78. static int acnt = 512;
    " v4 {" ?, w6 `: a- w/ g2 w2 ~
  79. static int bcnt = 8;
    ! j4 b6 `! j' p+ I2 c- h1 u3 \
  80. static int ccnt = 8;
    2 T- m8 V# g% y3 W8 P& A0 _
  81. # s  |9 Y+ e) N3 _; R
  82. module_param(acnt, int, S_IRUGO);- \1 q3 w2 |4 d' {/ B# O$ ^  `
  83. module_param(bcnt, int, S_IRUGO);! t7 n2 a2 F: q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 P: W2 z4 w% T7 V# Y
5 ^# I7 J- X$ m3 G* n; C- d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  J- S  q, R3 j6 A! Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ k' h  T0 H& T" V3 d9 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ]4 e! H" _$ a, G; _) g$ I. w, u) E- z! r$ P- p0 U+ y

5 G  b7 J: l/ B+ s# d$ s1 F! z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 20:44 , Processed in 0.040054 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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