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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 u5 G) L. O! E8 F+ H
  1. [code]EDMA sample test application: a- c6 u1 {0 |7 V0 G7 L1 E
  2. /*/ r% W* Z! g. Z7 N# C; z7 _
  3. * edma_test.c" _* y! u1 Q: Q9 S6 Z
  4. *5 c7 I3 _8 a8 u3 y, Z
  5. * brief  EDMA3 Test Application
    & e5 }2 T2 i7 Q% G, h7 n/ m6 L
  6. *1 P* e) V- |) a8 T% [
  7. *   This file contains EDMA3 Test code.7 P/ x& }4 C6 |" P! a
  8. *+ }5 ~  j5 C( t9 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) e9 c0 S  H- E! j+ ~  x( o4 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' z& a: {3 ^" d8 Y
  11. *         TO CHANGE.5 I8 u( k# Y; Y# f* c, w" I8 V
  12. *
    - ^" d0 Q! J0 }2 C. _" s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Z* g8 B+ {4 r7 F, |
  14. *
    $ F3 l  }* t, C7 h/ s' ~
  15. * This program is free software; you can redistribute it and/or
    6 T) M2 J3 b2 a9 P
  16. * modify it under the terms of the GNU General Public License as
    / g. B9 S3 n; j) b2 f9 u
  17. * published by the Free Software Foundation version 2.) c$ A& A+ k9 G( x8 m
  18. *
    % ~* n! P2 `, d$ ~+ F* B; E9 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" ]- {* l  _3 R0 c0 n* v1 X
  20. * kind, whether express or implied; without even the implied warranty
    / A0 }3 x! @  G6 q+ k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% S! S$ Y) g7 `
  22. * GNU General Public License for more details.5 g: f' U: x6 J/ y
  23. */
    3 X  b9 q( p# B1 c3 n# e# m
  24. 5 J" Y# l5 t" e" o' v) U
  25. #include <linux/module.h>0 j) R' ~0 Y3 _; d1 Z9 H" V! \3 ]
  26. #include <linux/init.h>8 r. i0 T0 X( [( ^% L+ `! r
  27. #include <linux/errno.h>+ R5 _4 k/ P- K4 G/ K1 i( F
  28. #include <linux/types.h>% W0 k& L& C) H' n) x: Z' a
  29. #include <linux/interrupt.h>! Z4 A: N# q  V2 p5 L
  30. #include <asm/io.h>2 Q$ E( p. P1 R! u5 ~" W" y1 N9 z( s
  31. #include <linux/moduleparam.h>2 A4 O- V- f9 I* k) Q
  32. #include <linux/sysctl.h>
    ) b- x, k3 I8 }, b, [: K
  33. #include <linux/mm.h>
    & O, y0 E  P3 p: V3 C
  34. #include <linux/dma-mapping.h>) [: ^# j7 s, o& Z0 ?# O: f1 E
  35. 1 L. u! B" O4 O( R& t9 u( R
  36. #include <mach/memory.h>3 V" [  n+ W) O6 C& w/ n* Q% r+ ]& d
  37. #include <mach/hardware.h>/ T, Q9 [, S) N- J& [2 Z
  38. #include <mach/irqs.h>
    " F7 l, A, ]& v$ c4 g" c
  39. #include <asm/hardware/edma.h>
    : P& k& l/ W, {8 ]0 O8 P) U+ S2 O

  40. + Z: r" u3 l# D! M, K) e
  41. #undef EDMA3_DEBUG. u* T4 f4 H2 a
  42. /*#define EDMA3_DEBUG*/7 e3 h; _# _5 h# N

  43. % Y7 j) a0 k' x$ E
  44. #ifdef EDMA3_DEBUG
    7 b& z- N) }' ?- u, V) g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * q5 l' j2 ]! Y# w" d/ i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): f) J6 G4 f1 |  R: f6 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 c' R, {/ `6 Y) {% |! F! ]$ V
  48. #else. {" ]; F# S' t/ l% {. e
  49. #define DMA_PRINTK( x... )
    % z# |# W1 ^  ^
  50. #define DMA_FN_IN7 b4 ]8 ~+ _$ `7 X' M; w! ~
  51. #define DMA_FN_OUT
    + d/ y4 n% l! U# g/ Y% {
  52. #endif
    4 D+ s0 ]/ R# d: z& L
  53. $ l& T* Y; B  T* c. K+ H4 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! B$ k. U9 t  u" L: F: b
  55. #define STATIC_SHIFT                3
    5 k# Y  W) |7 W6 \' L* I9 _9 T: o
  56. #define TCINTEN_SHIFT               20- Z$ r5 p( F" Z4 Z8 F
  57. #define ITCINTEN_SHIFT              21
    , D- I9 M6 a& O$ k) O
  58. #define TCCHEN_SHIFT                222 Q, I' x7 h5 B5 {+ z- g. x
  59. #define ITCCHEN_SHIFT               23
    % |& M  H. O* Y; @, i8 m
  60. * u" F$ q1 p; q! r4 r& e6 x& M
  61. static volatile int irqraised1 = 0;; p# D& f1 c$ m3 t2 v( w$ `! i& Y2 k5 v
  62. static volatile int irqraised2 = 0;
    7 b5 h& A9 \" Y! x
  63. ( v* o, R; p# D# E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 d# Z' \8 {2 U2 p3 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " i1 p* `4 e$ w& x3 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , N' P3 z, @( o+ f: |: C# t' t* L  }

  67. 1 Q0 W5 |6 i: x/ k  k/ A* k$ X
  68. dma_addr_t dmaphyssrc1 = 0;1 H5 m$ }# e6 J* V% d
  69. dma_addr_t dmaphyssrc2 = 0;
    & w. j$ @5 J9 _3 B% V
  70. dma_addr_t dmaphysdest1 = 0;4 c9 i2 Y+ ?! _7 f& z& a7 |
  71. dma_addr_t dmaphysdest2 = 0;
      p% m( P& J  f% s6 e. K, x6 K, x/ ?+ l

  72. 5 H8 M5 r3 Q% K+ S( c& q
  73. char *dmabufsrc1 = NULL;& q0 o3 X3 W! r" W; o
  74. char *dmabufsrc2 = NULL;
    , z0 u( q! a3 E# \- {8 J
  75. char *dmabufdest1 = NULL;
    5 o2 n! T) s. K! j# ~: i
  76. char *dmabufdest2 = NULL;- d3 R5 p$ H% |  n! X( X7 u- Q9 m; }
  77. 1 s: l9 ]) X* w$ C7 o3 o
  78. static int acnt = 512;
    : Z# Y1 d# t: I) ?% T4 l5 b. r( r4 n
  79. static int bcnt = 8;% S2 F. G' t8 E+ Y  m' s
  80. static int ccnt = 8;& Q- H4 Y" T! @7 Q0 z% S. i' [
  81. " I6 D; S& J1 P( P" q  m2 L
  82. module_param(acnt, int, S_IRUGO);7 m* |4 \7 t% H/ _# d: D
  83. module_param(bcnt, int, S_IRUGO);6 t1 x$ n/ ^; K& C6 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: O' o# _/ l6 W" ~& P' I1 N# A9 E- O1 i4 k! L: a- F, i% Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 N  R. m6 |2 f, t0 f- xarm-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 r6 u: b$ V( a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, Z& D( E  T# M) Z9 T7 H0 S# a7 R9 D6 L2 A+ ]8 Z# q! w! p
4 p, W* D- s3 M( j9 s& p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 15:20 , Processed in 0.039720 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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