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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % d+ x2 S) [. d/ [
  1. [code]EDMA sample test application
    ! J6 M' E1 N  K8 @* d6 u
  2. /*
    1 d5 N0 l2 r  m# Q+ C7 i/ f
  3. * edma_test.c
    - h; r  C1 f! ~. g( Q* Q+ j
  4. *
    * j" o$ V) Z2 {+ N0 W( D# h0 l& k' L
  5. * brief  EDMA3 Test Application
    - C. v8 p0 E4 s2 O
  6. *
    4 C# a9 E6 [" R  f/ H- S
  7. *   This file contains EDMA3 Test code.
    + K6 K& l) f5 L' X- @6 `+ I7 o
  8. *
    ' t8 {8 a* ~  a% P( M, U0 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) o7 a& |9 j9 L3 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, L* _1 B  B! ]
  11. *         TO CHANGE.  X1 T0 x( L6 a! ~% S1 ~: P/ [
  12. *! f* X2 I7 q) @. m  M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. I# `9 n3 \" Z. |
  14. *
    # d! O; t5 @4 O7 l2 J7 h2 G
  15. * This program is free software; you can redistribute it and/or6 t0 Z% F- t6 w/ a; N) t% ^
  16. * modify it under the terms of the GNU General Public License as
    2 J! g; \& Z7 B+ l
  17. * published by the Free Software Foundation version 2.
    ) Y4 t4 q  _9 T9 q
  18. *1 E4 C! C# H3 J& R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* M2 ~8 x$ ~& @. ]6 y. C
  20. * kind, whether express or implied; without even the implied warranty5 U- k( Q- {6 r+ z5 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 j  ~" H; W; D* ~4 G
  22. * GNU General Public License for more details.( {3 q( q: b$ X9 c+ O
  23. */
    5 y& u5 Q6 p* X& W1 B4 n7 g
  24. 0 ^) I& H- k! v% V2 y8 `* v
  25. #include <linux/module.h>7 \/ `4 {2 `* G4 R3 }- d
  26. #include <linux/init.h>' x( g: _' l, L4 Y' ?7 [
  27. #include <linux/errno.h>
    ! b7 x! k- @  q( T  E4 z( T
  28. #include <linux/types.h>
    5 {8 |) F' `9 o& v- A& d& S
  29. #include <linux/interrupt.h>7 y" S2 K$ K& ]: _4 p
  30. #include <asm/io.h>
    : A# z; o, D) E  q- ?& K
  31. #include <linux/moduleparam.h>7 C! @( ?% I/ e3 t1 ~! s
  32. #include <linux/sysctl.h>  \# R( Z- V0 u! f1 s
  33. #include <linux/mm.h>& N' a( i# N/ i3 K1 w
  34. #include <linux/dma-mapping.h>
    % k# t( [4 [/ N8 j
  35. 9 w3 l/ n2 w) Q5 ~8 f6 O7 ~( C
  36. #include <mach/memory.h>" P# ]! g: e% H4 G: u
  37. #include <mach/hardware.h>
    0 c- Y5 O7 {& V+ ~& U! J8 Z8 S
  38. #include <mach/irqs.h>: ^; i$ [. H. D, b7 Y5 m
  39. #include <asm/hardware/edma.h>$ e0 q0 R2 v* u$ `7 v  L- W9 X
  40. 2 P5 M& W$ o9 u1 h+ U4 w8 u1 a
  41. #undef EDMA3_DEBUG
    6 H: E' P) x/ ^7 K! ?
  42. /*#define EDMA3_DEBUG*/7 V& |% b5 d, _; N$ |

  43. & o( n7 h" w, V# N0 n6 o8 t8 o
  44. #ifdef EDMA3_DEBUG# S" \* O) u. I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ U2 Z1 a0 l2 y0 R' q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! w- v' \! n% r5 `; a3 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 D$ U% m" y& ^0 u  c1 U5 q
  48. #else1 l; Q) W6 q9 x# W+ u3 @0 b
  49. #define DMA_PRINTK( x... )$ _3 I1 r) ~' h- `+ J
  50. #define DMA_FN_IN
      y9 Y; z0 \2 s' X! x, f/ a( O
  51. #define DMA_FN_OUT& r2 S  Z% T! I% T* q# y  s) @
  52. #endif7 v0 Z, |# f, v0 `- e/ Y
  53. 5 f3 @8 X3 _& u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % H4 I/ G) p4 [9 L, l- @
  55. #define STATIC_SHIFT                3
    0 q7 q$ p4 |: G) r* p
  56. #define TCINTEN_SHIFT               20
    ! c1 j( r, D6 Z% r4 s3 v
  57. #define ITCINTEN_SHIFT              21/ _# g' o9 G; _1 [  K1 S  L9 w; u
  58. #define TCCHEN_SHIFT                225 C% `6 C/ G! M# h" \
  59. #define ITCCHEN_SHIFT               23
    ) C- G* C1 A% v" V! Z
  60. . h( O, _: x: @3 D1 `7 {
  61. static volatile int irqraised1 = 0;
    $ s7 J/ y0 I5 A: P5 W+ q5 X3 h
  62. static volatile int irqraised2 = 0;" x2 E! b: s. l& S  q8 A* B. r

  63. + k2 V, }$ j( |5 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 S6 J- }* t9 F3 G/ J6 ^4 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , c5 R- }4 @: J9 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 U2 u) m% @" ^$ k: ~
  67. . m+ W5 o' y& `( y( e
  68. dma_addr_t dmaphyssrc1 = 0;
    6 O. j' e% P# K$ `; }
  69. dma_addr_t dmaphyssrc2 = 0;0 G; [! |/ D, j* ]+ w
  70. dma_addr_t dmaphysdest1 = 0;
    4 a, l( X- ]) K7 M
  71. dma_addr_t dmaphysdest2 = 0;
    2 E  r2 U* B$ `( a) T

  72. $ W- _( c( L# J& s' p8 L
  73. char *dmabufsrc1 = NULL;, p) p+ ~. V7 Y3 n0 D' a! i! h
  74. char *dmabufsrc2 = NULL;
    3 V& f0 V$ X7 x9 |! d5 _
  75. char *dmabufdest1 = NULL;
    1 l( R! T9 O" o; d
  76. char *dmabufdest2 = NULL;
    , o# R: [0 G! X1 E0 M  h

  77. 1 V5 x) ^* e( |
  78. static int acnt = 512;& q) f) O- E; ~
  79. static int bcnt = 8;
    : H& r; J" I2 B7 R
  80. static int ccnt = 8;0 `1 d/ @0 x9 P4 y) S1 r( f
  81. 9 }% o, g  A* S
  82. module_param(acnt, int, S_IRUGO);0 g9 {, s- o, H, ]- [7 _# w  V9 n5 f
  83. module_param(bcnt, int, S_IRUGO);0 s$ a* Q" o7 d+ C) p8 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% E$ z: U; {$ Y8 a, f
' [1 M0 v- R# _, d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: k+ Z$ K; g+ U: y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ ~4 E8 Z) X- A& k) g1 b" _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- w! ]# a4 m+ Z  t0 f  U2 [0 h5 k  k4 D5 P' Y' {5 x
* W" b  A$ V# ?" @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 21:05 , Processed in 0.038221 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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