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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - M$ m* z8 x  W. O  \
  1. [code]EDMA sample test application
    " H* Z( x" t9 ^. p$ ~! Y0 e
  2. /*
    & }! G+ m  g$ M: l/ Y
  3. * edma_test.c
    $ z9 U' z  o4 p! {; [+ W
  4. *
    ; ?2 S6 @% F1 d3 J! H7 C1 R! B+ }
  5. * brief  EDMA3 Test Application
    ( q1 p7 x' y) l" {  H9 K
  6. *
    ; P$ n2 A* v  d) i( o7 [
  7. *   This file contains EDMA3 Test code.9 S- V' Q6 T* b6 S3 b, z6 o
  8. *6 O3 G1 m! x& a, `  t- X9 a* I) l, _! r9 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! Q, A& }6 U$ ]4 g1 J8 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; Q* Y! }2 ~0 }: A
  11. *         TO CHANGE.
    4 R) ~. U4 i% f3 n
  12. *
    , ~# ~% c. n+ t# \5 n$ I) Q$ K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 {3 t9 W/ ~3 o; G! S8 S
  14. */ Q& E" |7 J9 U, F& H* l- F
  15. * This program is free software; you can redistribute it and/or8 h$ k/ f6 h8 y, W/ ^0 P/ |+ e# d
  16. * modify it under the terms of the GNU General Public License as' K! h! t0 @5 n3 N. Y4 ?7 n; k
  17. * published by the Free Software Foundation version 2.
    $ }* G4 E  U  W
  18. *$ S6 S9 I' `$ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 y9 ?! W3 a5 O: N1 ?4 K2 v
  20. * kind, whether express or implied; without even the implied warranty
    ) R# r( ?$ q, _; H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & k  l3 y/ \* i! j/ O
  22. * GNU General Public License for more details.
    7 C1 N4 `& K5 Y" `: J! j
  23. */. K, [; n+ o! I  I( m

  24. . D6 @) V! M: ^' C& i) x7 u
  25. #include <linux/module.h>6 F& d! [1 S- o% X
  26. #include <linux/init.h>5 s4 a! B8 K8 d' B
  27. #include <linux/errno.h>% \. t. b9 r+ O, V+ k
  28. #include <linux/types.h>
    : q1 d6 Q" L  B4 M- Q/ u
  29. #include <linux/interrupt.h>: ?+ @( d& ^4 t, ~
  30. #include <asm/io.h>
    & W2 {$ P+ W4 q
  31. #include <linux/moduleparam.h>
    ' z' @: V2 J' M( s3 u4 w
  32. #include <linux/sysctl.h>
    : r! R1 C9 i( i: }: }4 \5 K& T
  33. #include <linux/mm.h>
    ) ~  e0 b" ?3 ]! \/ z$ G
  34. #include <linux/dma-mapping.h>- w' c0 X! a6 B$ b( L5 l

  35. 5 A8 _% O8 M8 ?* ~$ z3 q
  36. #include <mach/memory.h>0 U/ Z' j& D3 z' \, h' D/ x9 T# S/ g
  37. #include <mach/hardware.h>* {5 I5 Q5 a' t2 O2 E4 ^: f
  38. #include <mach/irqs.h>0 P& k1 B6 K' V- e
  39. #include <asm/hardware/edma.h># l4 L$ b% f, v* _3 F
  40. / p5 o2 K) d; w; A! u
  41. #undef EDMA3_DEBUG
    $ o" f( g& a2 O# [2 `' t
  42. /*#define EDMA3_DEBUG*/$ j, ]4 ]$ J& a. ~/ z" [* I- s# t
  43. 5 N- m2 e6 L$ D# f' [7 K
  44. #ifdef EDMA3_DEBUG
    * j) Y+ f. k- ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): L7 M  E; g* c* C- S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , ~) q( x4 J. f. |0 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - n7 L  }0 E. t# z
  48. #else
    ) V5 d7 P/ s! d0 E+ I; c% t+ j, s5 O! d
  49. #define DMA_PRINTK( x... )5 M- B/ K- i# r5 p
  50. #define DMA_FN_IN( T* ~/ V5 f0 X$ {% O5 |
  51. #define DMA_FN_OUT6 w, y/ S/ k% W* c$ h* d; ~$ D
  52. #endif9 u) p5 s& m: g# g4 N7 x9 N

  53. ; C* ]3 L5 r9 A/ X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( [& r. ]# A$ n3 f4 C" Y& X5 K
  55. #define STATIC_SHIFT                3
    2 p+ u& T( M* [! ~" v6 `
  56. #define TCINTEN_SHIFT               207 [& E& B3 _! L
  57. #define ITCINTEN_SHIFT              21
    ' w7 j9 [) Z2 O% e5 |, G* \
  58. #define TCCHEN_SHIFT                22
    1 |2 D3 n: d) ]! W" E- o5 [
  59. #define ITCCHEN_SHIFT               23: _5 O5 X: F2 g
  60. ; |/ z  H% [# ]& ~
  61. static volatile int irqraised1 = 0;
    % h8 k  B1 C& |8 A4 T+ b! G
  62. static volatile int irqraised2 = 0;
      A4 u2 l0 J( x, F, ?. G0 X
  63. 4 f) \3 V; q0 S& T" V7 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * I  `5 q& [+ s& v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 S' Y; _/ f) L: y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / w  [2 c; \" A

  67. ( ^+ R2 Y1 U: X7 W% v
  68. dma_addr_t dmaphyssrc1 = 0;
    # |" t6 `7 E8 _! V/ x5 c- j
  69. dma_addr_t dmaphyssrc2 = 0;! ^6 Q+ j" D* K2 ?4 a2 g$ f- B
  70. dma_addr_t dmaphysdest1 = 0;  V  q* [4 r  T2 z3 o7 }
  71. dma_addr_t dmaphysdest2 = 0;
    9 A; {4 I+ V7 G  w# T9 c. z& a$ ^
  72. 3 K; o0 W) C) e( U- i, g
  73. char *dmabufsrc1 = NULL;) Q* r! o1 ?/ \
  74. char *dmabufsrc2 = NULL;
    & |5 a+ p6 U3 g' J
  75. char *dmabufdest1 = NULL;. i6 C* w0 F  m
  76. char *dmabufdest2 = NULL;
    2 k) L- [. S- |; I" L

  77. : H5 p$ Z5 o( W  }. I
  78. static int acnt = 512;
    + J: `; M; X2 ]' m& C
  79. static int bcnt = 8;
    0 u- A' _+ _* [9 j# X
  80. static int ccnt = 8;) f# v+ z. E) O7 g8 Q: c
  81. & _2 s. L0 U/ \. K2 s
  82. module_param(acnt, int, S_IRUGO);# }% R, ]. ]$ n* @* m) \. ?' G- B
  83. module_param(bcnt, int, S_IRUGO);" P' U3 @5 y( ?7 ?/ ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: n- c- ?, a9 W1 t1 T& G( G, K) m) Q1 m; D: y4 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( v+ B+ K: C9 X. y3 harm-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 E" V1 g* M( i4 G& u7 w& |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( l9 i( V' a5 V, L3 H
3 O- p, i) H) q6 S! q2 R& g. |

. Z. ~  t- i" E* i+ {5 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 13:41 , Processed in 0.054245 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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