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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # r" ~; @5 ~) k9 x' B" \8 a6 R4 }
  1. [code]EDMA sample test application
    - o* L; q' z" Y6 [9 f
  2. /*- o1 J7 y' W0 A2 r
  3. * edma_test.c, r$ j5 @8 h2 j* a
  4. *
    ! d6 a5 K7 X4 p& _; L/ h2 g; W7 P
  5. * brief  EDMA3 Test Application  O" ]* ?) l6 S! w0 n. X: |
  6. *
    3 i& V. V5 Q" o+ W2 z  n
  7. *   This file contains EDMA3 Test code.) r! D, M  L0 b! ?- V0 W( M; S
  8. *( J* i# l1 _. S& [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . w5 u( G6 t. f# f1 T2 O# `$ i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 g& S2 t4 R9 F. d
  11. *         TO CHANGE.
    % ?6 r9 W1 z# k8 O
  12. *" r4 q7 g3 G: e, ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 A% r. I: c& w- H* O0 p0 W
  14. *, p8 ~0 v8 Z% @; ?- Q
  15. * This program is free software; you can redistribute it and/or
    % b  a2 B) e  t! h
  16. * modify it under the terms of the GNU General Public License as
    , T3 I+ P0 V$ S: h! ~
  17. * published by the Free Software Foundation version 2.' M4 P& n' e+ J7 |2 a- r
  18. *
    9 Y5 p  {! C; k& S. Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 @1 @  n% D: U. d8 w, R
  20. * kind, whether express or implied; without even the implied warranty
    4 R2 d& p( {+ K. y5 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 ^+ \8 l9 b& G
  22. * GNU General Public License for more details.6 L9 f. S9 ]$ H% t/ t+ g+ A
  23. */# j) O5 |+ U# G% ~9 a. Z( L
  24. 9 ~6 W- C' X( N$ f0 v8 K
  25. #include <linux/module.h>, `7 L$ X6 v4 V* b6 n. G0 x* y! }
  26. #include <linux/init.h>0 w+ k* Z6 B0 F  G
  27. #include <linux/errno.h>1 ^( I9 F+ F4 ^- P+ t
  28. #include <linux/types.h>
    2 W$ p) W7 M7 e9 n
  29. #include <linux/interrupt.h>
    " S& j1 V8 e' s" u3 L3 f
  30. #include <asm/io.h>
    # y) n) d2 ^) h" N" l
  31. #include <linux/moduleparam.h>% ?5 S# w; h5 O1 B
  32. #include <linux/sysctl.h>
    * U) C9 [, ~3 V- L$ i* S0 J
  33. #include <linux/mm.h>
    ! N: j; z( k) K# x& d" F
  34. #include <linux/dma-mapping.h>
    ( B0 x- W. Q- |, A8 q- |+ ?0 t

  35. $ y* O+ u- z  c8 q
  36. #include <mach/memory.h>/ Z8 R7 h( `1 Z/ c+ f6 _: T  Q
  37. #include <mach/hardware.h>
    6 {+ L( C5 T+ ?! K" t+ ]
  38. #include <mach/irqs.h>
    2 e& b% W5 `- L) z9 _+ ?% E
  39. #include <asm/hardware/edma.h>
      a* K2 y6 }, ?% J% g
  40. $ p: {$ ?& q) z3 ]- S  O" m
  41. #undef EDMA3_DEBUG
    - P7 [; @3 |3 m8 f# }
  42. /*#define EDMA3_DEBUG*/- o0 X$ r+ ?' t& L" N) K: X9 m2 |% c

  43. / l: V) s' ^% w& C
  44. #ifdef EDMA3_DEBUG* A' K0 m2 f! e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' f/ |) w( P9 \4 D' U0 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 o0 Y1 i, k8 E, Z1 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 S5 x9 h7 x1 w) n
  48. #else
    8 l# K$ w$ \- L7 \' a' v% n7 \. `
  49. #define DMA_PRINTK( x... )! r* h1 F0 f4 B
  50. #define DMA_FN_IN
    * ]( Z- \# e' V0 n0 v" j) y* ]
  51. #define DMA_FN_OUT
    0 u! ~  c8 l3 X
  52. #endif9 @7 Q9 n+ s1 a/ D' k

  53. 7 y2 s8 ]. o/ d0 v4 w% a! i: r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  N, C9 r) q' h  ?& P7 @6 x. V
  55. #define STATIC_SHIFT                3/ @9 T# e/ q; M  M* H
  56. #define TCINTEN_SHIFT               20# ?3 O5 |9 ^& Q, d, o( U4 k
  57. #define ITCINTEN_SHIFT              21+ }) V' h3 F7 d& l: Y
  58. #define TCCHEN_SHIFT                22% B& H0 K9 U4 W5 `
  59. #define ITCCHEN_SHIFT               23  E5 I. f8 t: L* c
  60. & f& z/ ]$ z  [' c" E% m6 s& J
  61. static volatile int irqraised1 = 0;
    : J2 R, I8 z" X/ u& j  V0 Y) S
  62. static volatile int irqraised2 = 0;
      a. v* O: p; Z1 p

  63. # y: j9 e- I% _& N' i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 t* b2 _$ m  |, i. z# m5 F" r7 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , }6 p  P* ?4 P! j8 A; U5 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ?% S6 D5 G" g2 X3 L- ~
  67. 1 V  d! m0 Q$ w3 r( P
  68. dma_addr_t dmaphyssrc1 = 0;) Q6 c: I/ Q: F& N) H
  69. dma_addr_t dmaphyssrc2 = 0;% ]: |8 y- L4 @, i
  70. dma_addr_t dmaphysdest1 = 0;% h* V& }, ]% [4 h4 T
  71. dma_addr_t dmaphysdest2 = 0;
    9 v" y9 {, Q1 Q+ p7 ~

  72. 8 J! l. D( Z3 ^
  73. char *dmabufsrc1 = NULL;" g2 y# B8 O# ?4 T) ^( ?
  74. char *dmabufsrc2 = NULL;
    * V; O7 `) ?! K! k; s( w0 x' Q
  75. char *dmabufdest1 = NULL;
      ?5 b8 h( a- g, k. ~( q
  76. char *dmabufdest2 = NULL;
    % N& N* d9 o+ Y& Z
  77. ; g* ?$ z2 m' E/ f
  78. static int acnt = 512;) f/ v7 u4 W3 {# h
  79. static int bcnt = 8;
    2 V+ X% Z: a& D8 _; A( B/ T
  80. static int ccnt = 8;# Z% z4 K  d) q4 t/ L, d

  81. 3 m7 _/ ^3 {3 j- N
  82. module_param(acnt, int, S_IRUGO);
    , V. l" h( `+ W; x$ P
  83. module_param(bcnt, int, S_IRUGO);5 x* x% }/ E; a) t0 x3 U7 c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& g$ {  }1 @/ @( w8 s% c3 S/ x" a) {& W0 o: q& E/ M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ]2 [- Q9 c$ C, aarm-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 g% x' J, e0 |" |+ U* z0 _  ~& V& C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 [! j3 x9 k0 l" T. r+ V+ [' e6 U7 W/ T4 F+ |% |

2 h( M! W% q$ r7 m( R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 12:52 , Processed in 0.039546 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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