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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 @8 _( ~3 j2 u; i# v% Q
  1. [code]EDMA sample test application
    % F: l4 ?% n/ b/ W( g# E
  2. /*/ S% }; W! L: R, V% h
  3. * edma_test.c: Q: M$ ^- G7 B2 s! N0 G. Z
  4. *
    $ _9 n& |% F- b+ V# c( h& j
  5. * brief  EDMA3 Test Application
    7 |& ^5 Q6 Y7 X8 f
  6. */ |) _0 n" `1 ~# t: g$ C
  7. *   This file contains EDMA3 Test code.4 Z( v6 }1 p( c$ A2 D: d
  8. *
    5 O- f" b2 ?8 H5 }* v* j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 j& I2 v7 l' O/ }/ v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- A5 p2 R/ w' ?0 P8 n0 ^( L0 D
  11. *         TO CHANGE.8 f3 b8 c) h9 P: S+ O
  12. *
    ' _+ u4 {/ V4 y# u7 ^8 r- _) X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 c: F" v% S( G1 S1 y. O! M8 Z9 |
  14. *
    5 p0 u6 n9 M9 ^8 h# `; W2 p) K
  15. * This program is free software; you can redistribute it and/or  `/ H  y$ G1 n9 O
  16. * modify it under the terms of the GNU General Public License as& V9 F4 ~* h9 `. q4 R
  17. * published by the Free Software Foundation version 2.
      }' W/ [% V7 V. U) H
  18. */ J& X. m1 @) C% y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 n# g* P$ E6 s& D7 ^; L1 T
  20. * kind, whether express or implied; without even the implied warranty
    7 x, v1 r7 h! W  I& y! B: |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & \: c( q  u- L* n& T/ I
  22. * GNU General Public License for more details.
    % `: G4 N% h6 `3 _
  23. */
    ) m% X" a% e# x! e8 e& F. |
  24. 7 B' t7 a6 W7 |. Q" |
  25. #include <linux/module.h>+ g$ ~# }5 g& K6 d
  26. #include <linux/init.h>
    - ?5 e. p! G) r6 P
  27. #include <linux/errno.h>
    7 M8 s- g5 [- e" i. N4 b9 N& }3 \' i
  28. #include <linux/types.h>) s6 l4 m+ o! B/ y+ O
  29. #include <linux/interrupt.h>( [& ?- D! D5 B* m! q9 n
  30. #include <asm/io.h>
    0 ]3 f! e/ V; |9 V" ^' r9 v! N( z
  31. #include <linux/moduleparam.h>, _) U3 M4 o6 t/ ?$ S
  32. #include <linux/sysctl.h>
    ( P- L) J: }3 i
  33. #include <linux/mm.h>
    6 c6 e4 Q7 R" B* Z6 W
  34. #include <linux/dma-mapping.h>
    2 F0 z: {* `. g0 p6 D6 n2 ^5 q$ D: w7 ?

  35. ; `) L! R5 ?2 F$ c2 E' N: l9 _4 ?
  36. #include <mach/memory.h>
      t( s( x4 ?! D& }4 h* ^  |$ A
  37. #include <mach/hardware.h>
    - p$ K$ R* B& t# s: X  B" Z
  38. #include <mach/irqs.h>
    - D2 |! l( v0 r4 c( D: D4 }
  39. #include <asm/hardware/edma.h>% O- ?1 |& f4 O

  40. 8 c& ]4 e: A4 q. d
  41. #undef EDMA3_DEBUG
    2 _7 T8 y8 ]6 c  y" |- {
  42. /*#define EDMA3_DEBUG*/
    5 ]( ~; B# h4 P1 O3 }+ v) }  o9 E
  43. , J* b' H. f4 {- ^- \
  44. #ifdef EDMA3_DEBUG
    / s9 n" k2 }- Q; @- f( I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ~$ d! u9 K( R6 u) }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; v% g3 k2 m' ~& q* D% o( a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 @" U! O" w7 P' e7 m
  48. #else: y4 @3 y2 H$ ~" Y- N; U
  49. #define DMA_PRINTK( x... ); F/ ]$ s( V6 K" [- N& S
  50. #define DMA_FN_IN$ d# g. Y! a' R0 V; `. y
  51. #define DMA_FN_OUT5 I0 [7 l, O- O
  52. #endif
    3 v, I5 P; g1 K: E
  53. , t; L* r. j/ ~+ t1 F! n$ W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 a' A( A0 W/ l7 W6 N
  55. #define STATIC_SHIFT                33 L8 l  [8 A) h1 P8 l
  56. #define TCINTEN_SHIFT               20
    ) m( A, n, X6 {6 z# E6 A# \) Q
  57. #define ITCINTEN_SHIFT              21; k; T' h/ k  ^* J) w1 u/ L
  58. #define TCCHEN_SHIFT                22
    2 }4 y6 P# c# `
  59. #define ITCCHEN_SHIFT               23
    4 O: ?7 M5 C7 A/ i* |
  60. 5 D+ o* x* x1 B: |+ L8 J' }
  61. static volatile int irqraised1 = 0;+ B/ E6 w& V; ~; I* m- ~
  62. static volatile int irqraised2 = 0;
    1 d: z+ |  d3 f8 |2 D/ h

  63. - q$ W, _$ c! g/ J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! A2 x, J$ u3 S: b5 Z8 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& c; a& [8 c6 a3 {6 I4 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 V, u: b7 b  H: f
  67. & j$ b% T  H5 K8 x
  68. dma_addr_t dmaphyssrc1 = 0;# I5 i' f: E2 n' H. x
  69. dma_addr_t dmaphyssrc2 = 0;
    6 @5 c6 o' K8 I6 f
  70. dma_addr_t dmaphysdest1 = 0;
    $ Y; X/ k+ v( P' O1 w
  71. dma_addr_t dmaphysdest2 = 0;- ?8 k( Z, T& s+ i

  72. 0 e) k( d( v2 @1 e
  73. char *dmabufsrc1 = NULL;
    " t$ ^. u4 k' ~. @9 z  a: B$ s5 L
  74. char *dmabufsrc2 = NULL;/ t+ s4 s2 X/ P$ H3 w
  75. char *dmabufdest1 = NULL;; N8 P* \1 i) _) t( Y, k
  76. char *dmabufdest2 = NULL;; e6 o, t6 n6 t0 _; l; }
  77. , |! J5 q1 Z' w1 ?2 w
  78. static int acnt = 512;
    & ~2 m0 @; _# n+ S  s) _
  79. static int bcnt = 8;4 h% @/ r1 d; _" z; B8 q
  80. static int ccnt = 8;
    % \. \5 w5 X4 R9 o& }

  81. 4 o& b+ q) v6 |8 Z' @& D8 @. M% ]
  82. module_param(acnt, int, S_IRUGO);
    3 h) Z* V1 K) l$ p7 p
  83. module_param(bcnt, int, S_IRUGO);- T5 u* c+ I+ T' y4 N& N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 t! V; j% H$ m( L
( S1 [  _4 M8 C# J0 o' b# \+ O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ o( Y5 T' Q3 ]0 q: Tarm-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 x: g3 ]) j4 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 V' }& c- i) k4 W/ x7 O5 }
, M( U$ k- ?- B" @3 S9 O
. c* t% U; Y% R% ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 22:48 , Processed in 0.040567 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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