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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* g8 d' l( W$ k2 O4 s6 h
  1. [code]EDMA sample test application
    % i1 B" l9 j/ q6 y$ }
  2. /*
    : `$ |, F4 @" L
  3. * edma_test.c% P7 `% l2 i$ ?5 A( |8 C/ l- K
  4. *; J3 B. }, c  \/ E' o
  5. * brief  EDMA3 Test Application
    3 u0 T. B% E. n% u3 W" _7 N
  6. *
    ) M& q. K5 n/ ^/ f! x
  7. *   This file contains EDMA3 Test code.
    4 s: u4 r% |2 S$ A
  8. ** j9 w/ }" g7 F; M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! v1 Q# k7 p! S# @: J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 `8 |3 n! E  ^( H/ G2 A4 z
  11. *         TO CHANGE.
    - ]/ F7 {- z4 q$ P  y0 p5 e& F% D, R
  12. *
    0 |0 n8 O+ O  \- N0 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) I4 D$ S7 Q( J" {' D/ |
  14. *) W* z0 i3 B' m
  15. * This program is free software; you can redistribute it and/or
    1 f! q. x% X- x
  16. * modify it under the terms of the GNU General Public License as% M7 L% H5 U$ \' `7 k: B
  17. * published by the Free Software Foundation version 2.! Q8 W! k4 T4 d0 D; A& X  x6 g
  18. *. H9 D% x( s* ^4 j5 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 c0 a. V, s: }8 ^- R/ [4 }
  20. * kind, whether express or implied; without even the implied warranty' Y+ q8 q4 E5 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& D( v4 Y, ]4 S2 M/ I# ]
  22. * GNU General Public License for more details.% S) g0 x% [' |: S1 p; m
  23. */( L, L  X" L/ I9 {4 g
  24. : ?5 k* P5 H, a3 o6 n) d
  25. #include <linux/module.h>1 U, [* F& {: e5 x
  26. #include <linux/init.h>
    ' r0 h$ `/ C' f. x$ Q. C: I
  27. #include <linux/errno.h>3 T3 T$ v  S' ~: C- C; S1 C
  28. #include <linux/types.h># P: ]) ^6 p, U" z& O! ]6 R, n1 y
  29. #include <linux/interrupt.h>. \0 u0 Y) F/ T9 r/ y3 q& ^" o, S7 i% H
  30. #include <asm/io.h>
    ! j2 ~& ]  h" \  s: Y# N: a4 z
  31. #include <linux/moduleparam.h>
    + F8 u* b) s/ X8 X
  32. #include <linux/sysctl.h>
    % m# k! v6 {* S) `8 Q  t
  33. #include <linux/mm.h>
    . D$ I3 g7 A' e4 [
  34. #include <linux/dma-mapping.h>3 i+ O5 Q. c. y2 G: W) h$ C

  35. 6 k5 d7 n# R+ ^/ {
  36. #include <mach/memory.h>- b+ c3 I: i- y
  37. #include <mach/hardware.h># Z3 Q* c. p8 ^- U
  38. #include <mach/irqs.h>* J1 y6 q  Y3 M, d
  39. #include <asm/hardware/edma.h>
    . O) u0 @3 U  p% C
  40. 6 q' r0 K; C* \+ ^+ P3 ^) E4 N
  41. #undef EDMA3_DEBUG
    4 e' L4 H# g; T5 d# b7 D
  42. /*#define EDMA3_DEBUG*/
    / L: m, A# P! N3 i, e' ~
  43.   N" `5 l& |7 _6 ^
  44. #ifdef EDMA3_DEBUG% D# a1 b/ I5 `9 ?3 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ _/ j5 a/ l2 w0 I9 }2 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 ?! C( V3 U( z" f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ?+ N& Q! H; D- u
  48. #else2 y7 |0 S$ X0 b: r0 V: A
  49. #define DMA_PRINTK( x... )
    8 X' o- X, w$ q5 T1 E1 M3 D0 g
  50. #define DMA_FN_IN$ L# E( w  K% c4 y8 e* m
  51. #define DMA_FN_OUT
    . i( o6 f2 l9 R/ A9 \
  52. #endif
    % Y+ j9 O/ m2 s8 y  m
  53. $ [! g( e4 D# S, B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% y/ D- p9 }" o
  55. #define STATIC_SHIFT                31 z/ ~( ^' c9 n" D# ?
  56. #define TCINTEN_SHIFT               20) Y* Z, D8 u7 z0 |3 Q
  57. #define ITCINTEN_SHIFT              21
    ' E, L; {) g3 u* d! p# ^
  58. #define TCCHEN_SHIFT                22
    0 R# i1 M, X3 n  D3 k. T& m
  59. #define ITCCHEN_SHIFT               23
    " X8 o6 S! U) c; ^: \1 m! b
  60. 1 H) G8 [' B; N! w
  61. static volatile int irqraised1 = 0;
    - z1 P! p' k1 t8 z4 Y( ?3 m
  62. static volatile int irqraised2 = 0;  E; \" g; s( x8 v5 c

  63. & k& V  k, C- t4 U% ~( Y* _9 X. _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! x7 Z- F& d4 P' @" ?+ b* s: F: ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d# d. D% k2 w# Y8 P; d; ?; E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Z  \! B$ a* K

  67. 0 a! _* b+ {$ w
  68. dma_addr_t dmaphyssrc1 = 0;
    0 U! [1 i# ]6 S- W/ S
  69. dma_addr_t dmaphyssrc2 = 0;
    , V7 ~# U7 G, D
  70. dma_addr_t dmaphysdest1 = 0;! Q- H8 A5 V( c
  71. dma_addr_t dmaphysdest2 = 0;
    . x  `' u- }1 S. |( k0 [6 p% m

  72.   m+ V  S4 e) [& T: [4 j& m0 x
  73. char *dmabufsrc1 = NULL;. b% Y, [: D# G" _! i2 l6 J
  74. char *dmabufsrc2 = NULL;
    3 o+ x( s" W6 a" i, W- ?
  75. char *dmabufdest1 = NULL;
    : X4 Y) ~! n1 Q6 z
  76. char *dmabufdest2 = NULL;
    6 q; ?9 H, l* K7 A0 z
  77. 7 H2 p8 O; K7 j
  78. static int acnt = 512;
    , \( J% V& r$ P) C
  79. static int bcnt = 8;( W2 V; d4 T; L; i) [
  80. static int ccnt = 8;: A- G& j" f. y+ K, c, I
  81. 5 G3 n) G8 D, z: Q3 S+ s9 @& Z
  82. module_param(acnt, int, S_IRUGO);# ]  y& y+ t0 w# G% W" {- L
  83. module_param(bcnt, int, S_IRUGO);% H7 I# q6 C: X/ d0 J: x3 x7 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ N8 q/ `, z! D& J7 `& ^6 S5 P  s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 ]- R% v; @7 n, \- J; Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 s) R* B* A3 h: x5 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( j) v2 o; d8 g* q) `2 B' F. ]

$ C4 J! {! c8 _( m9 }! s6 m( t- H* U  w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-17 10:40 , Processed in 0.039414 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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