OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 u6 v1 f( C) \5 U% L
  1. [code]EDMA sample test application
    - s# W0 w0 V3 b. d
  2. /*9 O/ `8 R1 L4 n
  3. * edma_test.c. F1 `% B& c' h/ w8 ~
  4. *1 x6 \5 c/ g, k2 {2 |
  5. * brief  EDMA3 Test Application
      m2 ~+ k: i2 F  ~+ y, V
  6. *, R6 E6 O3 O9 B0 k) y: M  k
  7. *   This file contains EDMA3 Test code.
    8 V: E4 G$ P; u( W$ n) z
  8. *
    * I4 C. w9 ~6 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ x- P% X- z& v" q9 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 l5 G3 c6 _: O; F& t7 G
  11. *         TO CHANGE.
    ) s$ _6 K+ q- Z0 U& P
  12. *: }4 A4 V5 z7 K" c2 V. G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  y4 t) l4 e: ?" H) n. p. c% `
  14. *
    / {, G0 Z- P- f6 }
  15. * This program is free software; you can redistribute it and/or
    ! u; r; _, o  @9 z2 H: T
  16. * modify it under the terms of the GNU General Public License as# \6 g& W. E2 O
  17. * published by the Free Software Foundation version 2.. d5 b+ T) y, V0 ~& \. h
  18. *; ~8 o4 N, F* B& A9 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : ^' Y! u8 {# L- p  U0 b8 F7 ]3 W
  20. * kind, whether express or implied; without even the implied warranty* d9 N9 W# J9 S/ s9 w! [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 P+ z9 ]* m5 A# k6 K+ C" F' L
  22. * GNU General Public License for more details.( @" o! t2 H) o+ N0 e% h. D
  23. */
    # t; d: @+ u. F  N5 K
  24. + O  p1 [  k6 B+ f
  25. #include <linux/module.h>
    / c# g/ M/ H2 {) Z
  26. #include <linux/init.h>& U: ~# \. w0 v
  27. #include <linux/errno.h>' R; V& J3 h/ g" Y6 D$ `
  28. #include <linux/types.h>
    9 s3 N1 @4 W8 v0 l0 ?. `0 ?- k
  29. #include <linux/interrupt.h>4 F+ g2 A. C& I
  30. #include <asm/io.h>
    , e6 ?. S$ x- S% \: z# S
  31. #include <linux/moduleparam.h>/ t: Y, O1 H# _! _
  32. #include <linux/sysctl.h>
    9 e- {5 R: U3 ]& R
  33. #include <linux/mm.h>
    : \; h6 N; L& B- [
  34. #include <linux/dma-mapping.h>' U2 W# K6 t: L- o* U6 h

  35. * X4 z& @2 p$ I* s5 d+ G( ^) h$ N4 f
  36. #include <mach/memory.h>
    2 D3 k  U6 I  J! b/ |* `
  37. #include <mach/hardware.h>0 P0 a  I$ A7 f
  38. #include <mach/irqs.h>0 v, h5 g7 \2 M- m/ ]/ E7 q
  39. #include <asm/hardware/edma.h>: D2 k. R6 ^5 v

  40. % `/ A% U" F+ E! D5 O# r' F: @
  41. #undef EDMA3_DEBUG
    3 \' z9 N1 F4 ?6 J0 C! v
  42. /*#define EDMA3_DEBUG*/
    9 o; J5 I; ?, _  U7 c" @# c8 A5 i
  43. 5 ]( n% ?  L5 s" s1 i' E
  44. #ifdef EDMA3_DEBUG
    7 S' p) q2 x* C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; Y* M$ M: q2 t: {' _2 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ n7 ?: ^% s/ \2 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# s$ b' f3 x/ q( j4 t0 n  G
  48. #else
    1 |8 T7 h/ ?# b
  49. #define DMA_PRINTK( x... )
    " d2 k  G+ z, K$ |' v" \" c
  50. #define DMA_FN_IN7 R# b* w! Q$ {. Q2 o9 w
  51. #define DMA_FN_OUT
    ( }: Z. Q3 f; p: S- Z* t4 Y
  52. #endif0 ^: D5 q# r9 w" l, r) Z
  53. ; _) |* j, m2 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( h$ ~, u+ a6 x2 t$ Y$ v- Y3 C
  55. #define STATIC_SHIFT                39 k' P) B- P7 \6 @+ S( b7 C. ~
  56. #define TCINTEN_SHIFT               20' c( x$ e. s- h- p! y
  57. #define ITCINTEN_SHIFT              21
    & d6 c& L* v4 o, \8 M
  58. #define TCCHEN_SHIFT                22
    & Q4 p8 ~- b8 H) A. w
  59. #define ITCCHEN_SHIFT               23
    ; [& Z$ n8 h7 u8 _
  60. . Y# w) }* y6 B' F
  61. static volatile int irqraised1 = 0;
    * |& ~- h$ M3 T
  62. static volatile int irqraised2 = 0;
    / n+ l0 T# _* i) D: y- a5 b

  63. 9 t" o* Y# R9 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t) R- q  k* V* c7 \6 U- _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % Y- f- S! }4 A& N( y+ i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % g* v6 d' g$ ~2 q/ I9 A4 }2 q

  67. * F8 z9 f. e0 s" a8 x4 F
  68. dma_addr_t dmaphyssrc1 = 0;
    9 e' `/ P& m9 e3 L, b) i
  69. dma_addr_t dmaphyssrc2 = 0;) x. A0 b! j1 Z
  70. dma_addr_t dmaphysdest1 = 0;& W2 U- k3 w2 o, i+ M+ S
  71. dma_addr_t dmaphysdest2 = 0;, F; ~* L) d/ Z' J3 ?9 X
  72. , V! {6 ?0 ?& a7 k
  73. char *dmabufsrc1 = NULL;
    - d' n/ C$ r' u/ R0 y! Y& D
  74. char *dmabufsrc2 = NULL;
    3 @, o3 u( ]1 r8 [
  75. char *dmabufdest1 = NULL;2 i/ K5 @6 E: n8 E" x, y  o
  76. char *dmabufdest2 = NULL;+ {! z& Y3 @7 v6 K* m4 L- N' [
  77. ) Y% P  \5 V6 d
  78. static int acnt = 512;) e+ h1 l# Z* L1 \
  79. static int bcnt = 8;
    + D' e1 P" M0 O$ E1 ^. ~2 F
  80. static int ccnt = 8;5 l& f0 f6 M( o+ q3 g
  81. 7 q6 ?3 V' a0 u% t, A
  82. module_param(acnt, int, S_IRUGO);
    2 ]7 j1 _; n. w! V6 v$ @  M' M
  83. module_param(bcnt, int, S_IRUGO);/ E6 |# g1 |: e/ i8 ]; b- E1 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 e/ j$ R4 L: \' C" B! P2 W
( K( j8 K; u& E2 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ^2 E! o  `& q4 F) v# C2 x+ C- K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* e; w4 H0 g4 L# Y, @4 m- B" ]' S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 W& t4 ]6 n0 _" q. I1 V: J

: t: N) M. E$ ^8 h% G9 q! C, h" T* ~, z% R4 @( `+ M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 17:34 , Processed in 0.037544 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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