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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ r5 b: J# q& o- E0 {
  1. [code]EDMA sample test application3 V/ O" Q7 c2 M. m9 D
  2. /*8 I# J7 }; J: L
  3. * edma_test.c. D1 s' P+ }% t/ h( T
  4. *
    ( k' y2 I. E" F
  5. * brief  EDMA3 Test Application- w/ M5 H8 O" L& p# y5 K
  6. *
    ; _; I9 J) ~. q4 N& T, j3 i5 O
  7. *   This file contains EDMA3 Test code.3 `! L+ }1 q, k3 K: Y
  8. *
    , U% U/ N; ]7 L* |; J* ?* {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; o% C) U9 A. t6 g% ~! D3 L) a4 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 p* ^& r6 y4 d, d
  11. *         TO CHANGE., w. g9 L# \1 x6 ]
  12. *- C, q) H( B; P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) |% n  C& o' F0 {* c& i
  14. *" q1 t" a  Y3 C2 G
  15. * This program is free software; you can redistribute it and/or( U* D* Q$ g$ _$ A7 b# N4 N2 F5 t
  16. * modify it under the terms of the GNU General Public License as
    ! W  G/ R& l7 {: d, q8 e$ S
  17. * published by the Free Software Foundation version 2.
    4 Y: M# `! t. ~6 v/ Z: R
  18. *5 ~5 J% B6 |9 Q+ F  N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" q: D& R/ _- @3 m1 g
  20. * kind, whether express or implied; without even the implied warranty
    * Q9 b/ c  n/ j4 n3 h9 V# v1 [8 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' o/ {; S: ^3 z0 b+ ~
  22. * GNU General Public License for more details.
    4 O0 I! {- e, _
  23. */$ p) ^. g! u5 w9 n' t
  24. " O) Z9 g* Z# s9 Q/ I. o: L! k" y
  25. #include <linux/module.h>+ }* }# |( Z1 S3 _4 h7 @0 A  _4 I2 c
  26. #include <linux/init.h>$ e+ x7 k: Y3 v3 c. U
  27. #include <linux/errno.h>
    : z$ V9 T; e  r- u0 E0 m
  28. #include <linux/types.h>
    * \5 \! ?  [3 d5 b9 ^% M! M) M0 S
  29. #include <linux/interrupt.h>
    ' J1 J$ U, b; k' F6 W4 N
  30. #include <asm/io.h>6 N3 `- ]( y$ b% S8 u+ s$ \
  31. #include <linux/moduleparam.h>/ }6 X; F" X/ B. V' y6 _
  32. #include <linux/sysctl.h>
    % m- m8 K# L! [3 z
  33. #include <linux/mm.h>
    ; ?' i$ q$ n6 M3 E! L# a* M: C
  34. #include <linux/dma-mapping.h>
    2 E9 c. T+ z2 s9 }+ D* N- l/ H, O  S

  35. 2 Q8 o- _8 q4 M5 Y9 H/ C& \7 _
  36. #include <mach/memory.h>
    7 z" T  w+ Q& M8 \/ i
  37. #include <mach/hardware.h>
    7 Z* H- r4 C& E2 H7 D( H( c, z
  38. #include <mach/irqs.h>
    " s  S- ?, I0 M4 d7 W# \
  39. #include <asm/hardware/edma.h>
    ) {' m& o; u8 E% C. P/ K
  40. 2 m" N  g7 x; ]& _
  41. #undef EDMA3_DEBUG  {$ M; Z7 Z9 |) Y8 E7 O
  42. /*#define EDMA3_DEBUG*/: _1 ^1 f4 F; q. r
  43. 7 ^) Z( ^+ s9 \0 V/ Z' v. p( H. w
  44. #ifdef EDMA3_DEBUG
    ' T$ j- a- d% v1 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 D) H0 w* r! H( D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 O8 w3 ]" Y8 c' e0 W: C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      f/ l$ u2 A0 r: d# J) i0 x( t
  48. #else6 ?4 K* F' M8 f( J9 R! U
  49. #define DMA_PRINTK( x... )
    3 p4 K% }+ U: m( L$ R; D# F5 M
  50. #define DMA_FN_IN2 v0 `; {+ V1 W* y. B7 @8 M4 Q
  51. #define DMA_FN_OUT
    / \, F3 |% p0 C4 d% Z
  52. #endif9 c& P6 J/ P- q  M6 a- m
  53. # q0 i0 o( D6 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " ^: r: v( u5 j) N
  55. #define STATIC_SHIFT                3: k" a6 {% G' \! V7 [
  56. #define TCINTEN_SHIFT               20
    $ {( e& N7 T# {& s' r, v
  57. #define ITCINTEN_SHIFT              21* _( f, d/ f& c; Y4 k
  58. #define TCCHEN_SHIFT                229 x* _2 O( f. C+ i0 Z
  59. #define ITCCHEN_SHIFT               236 Y) f" {0 d4 \( x* P# r: }, z
  60. ; ]6 m; G: F% M7 L# z' ?
  61. static volatile int irqraised1 = 0;7 ^3 r# |* M. k2 X9 t
  62. static volatile int irqraised2 = 0;
    3 f( M5 [4 s. n9 x% c
  63. : ^8 F! x; k, ~1 K, h1 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U5 b2 U1 [% f# _8 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; H9 p* B2 F; J8 s) H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      Q$ K/ J0 R4 F$ m  d- i7 V& ?1 ?
  67. + D9 A, I7 @% ^9 L& K; y
  68. dma_addr_t dmaphyssrc1 = 0;- r( ~8 e  s$ C9 P4 v
  69. dma_addr_t dmaphyssrc2 = 0;: D8 l3 i5 S$ ?. r
  70. dma_addr_t dmaphysdest1 = 0;
    3 ~9 {# N" x  M9 Q; E
  71. dma_addr_t dmaphysdest2 = 0;& H& V8 c  F9 f% |* o
  72. ' D) e8 @. T: X- W: f* k
  73. char *dmabufsrc1 = NULL;
    + ~$ @; w2 Y2 g7 q' r
  74. char *dmabufsrc2 = NULL;
    7 E+ K7 `4 X$ G, x$ W# T& I
  75. char *dmabufdest1 = NULL;
    - g- W2 G( v6 \/ J( [
  76. char *dmabufdest2 = NULL;. O* `& z0 o/ {

  77. 6 P4 R5 e9 x; s: f5 c
  78. static int acnt = 512;
    ( J4 A9 m- m, N! D9 U$ r; B  T. C. }$ @
  79. static int bcnt = 8;
    6 W6 f2 O7 A# x. i
  80. static int ccnt = 8;
    8 e0 C/ \/ p0 y, [# T2 P
  81. ( |( o( @9 r; A* q
  82. module_param(acnt, int, S_IRUGO);+ P  T" C# A& k4 A: y0 ?
  83. module_param(bcnt, int, S_IRUGO);
    / m5 d0 o: w% z8 s8 \1 h/ ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, X1 S% ]! v6 @
% q$ C  H9 U; H- u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* T" C8 M) h/ E( Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! U- L1 H, G0 y% N: q& c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 I' M9 x1 {) _
! ?. Y5 O, |1 `. S3 b% d2 u: Q; T: X' G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 22:49 , Processed in 0.039656 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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