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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ F2 q! }( i3 ]; ~( U* t
  1. [code]EDMA sample test application! u6 K. p' L: g
  2. /*9 M6 c" ~; M# }& U; |( G+ }8 E
  3. * edma_test.c6 G8 r  a! x' m
  4. *
    : R0 d& @0 _! T" @9 `
  5. * brief  EDMA3 Test Application
    5 B- k' \+ D2 y# n. j/ l  V
  6. *7 x3 Y' D' {* r4 N$ K% x- B
  7. *   This file contains EDMA3 Test code.
    5 |) V; Q8 L" |0 z9 }1 q7 h' F* r& i$ W
  8. *- N! d+ `$ o; n$ \  f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 u2 ]( C8 U; v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; `# w$ ~+ U8 o$ S3 k  W* ?
  11. *         TO CHANGE." I, E! s; O! |  |0 P$ G' N4 P
  12. *
    3 n$ A. \8 r5 c* o. e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( {3 M  C" p6 U; Y6 K/ R9 F% i
  14. ** y. X; u: K" S# R) v$ M/ ?
  15. * This program is free software; you can redistribute it and/or
    - y. k1 }0 R# z0 X5 I
  16. * modify it under the terms of the GNU General Public License as3 l: \* ?1 h' d
  17. * published by the Free Software Foundation version 2.! K  Q; H/ _: S4 L& O" U
  18. *- @5 Z9 i0 Z4 v/ N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 _1 M% C9 F1 N4 y( O; o. G+ H
  20. * kind, whether express or implied; without even the implied warranty' v6 ?" S6 g2 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 [- g+ h7 s; D* }
  22. * GNU General Public License for more details.1 c: a2 E8 S! T
  23. */4 ?9 }# _% Q; p! @0 m3 N& k

  24. 7 U+ x! l* s) X' J. s
  25. #include <linux/module.h>  r+ Z  o2 e% A$ @
  26. #include <linux/init.h>. Q: u6 W" E5 Y9 g3 n6 l
  27. #include <linux/errno.h>
    ' O, w) S% B/ h) K
  28. #include <linux/types.h>7 |# ]( ~4 q$ j* v1 d; x
  29. #include <linux/interrupt.h>
    4 M8 c0 E' T  @$ ^4 ?6 f3 `- u
  30. #include <asm/io.h>" h0 I2 p  D1 S' Z- P% @- d" v( o+ i
  31. #include <linux/moduleparam.h>7 U% u( }% ]* ~
  32. #include <linux/sysctl.h>
    9 }: w5 q/ b) L3 r  ^4 l3 |6 B
  33. #include <linux/mm.h>
    7 _6 ~! T1 P+ W) b
  34. #include <linux/dma-mapping.h>
    3 R/ P; w9 [, `! P- P
  35.   N; g" Y, n  E9 v6 X; }
  36. #include <mach/memory.h>
    / N1 n; t" C2 n$ P
  37. #include <mach/hardware.h>& D7 G. Y2 y) I# D0 _% g
  38. #include <mach/irqs.h>4 T: Y$ I% F2 a* {+ V0 [  c* X
  39. #include <asm/hardware/edma.h>$ k- u% c% _- b$ {' l6 C( c
  40. ( C8 c8 k- h- l5 V1 C: _: U$ v$ O
  41. #undef EDMA3_DEBUG" L9 Y5 b$ c! b, [
  42. /*#define EDMA3_DEBUG*/) T$ f6 Z# ?& ^  }! O$ h% s3 h
  43. ) b/ p1 G4 A; x; D
  44. #ifdef EDMA3_DEBUG% b0 ]! t. J9 [# J" {! a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / `2 ?& f) f! T5 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; [! D0 Z5 C0 V, k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - {, [1 ]: ]' B6 d
  48. #else
    0 c: D; c+ W1 m6 c; u0 ~
  49. #define DMA_PRINTK( x... )# L) D+ d  |5 u' w7 H' i
  50. #define DMA_FN_IN
    + z* L& y; u1 |* k1 r
  51. #define DMA_FN_OUT
    ) d  {& `6 F+ _' j+ X
  52. #endif
    $ [( |* b( m2 b5 L. Q9 V) A
  53. ' U* q( L; R: @8 P, y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 ]; m% ^' o. s7 y* e
  55. #define STATIC_SHIFT                31 Z& H9 J3 B2 N
  56. #define TCINTEN_SHIFT               20
    ' M. x# Y# S$ y/ C  a2 @
  57. #define ITCINTEN_SHIFT              21
      S4 R& [& S& y+ P& H: t
  58. #define TCCHEN_SHIFT                22
    $ B9 _& l& O$ A. N6 ^
  59. #define ITCCHEN_SHIFT               23
    / T' K6 O' L- H  I1 b% k% z
  60. ( z, h9 U$ I4 a
  61. static volatile int irqraised1 = 0;5 ?$ Z, g% d  W# r* S1 |' s) L
  62. static volatile int irqraised2 = 0;1 R' S3 s* E4 w6 I2 f% o5 p7 t5 B- Y

  63. * ?/ P, W' U1 A$ Y. \; ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( X6 L1 G( A  c/ E1 n: j) O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 Z3 |. P/ H" n: V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) s1 I7 @: Z4 O7 d
  67. : x7 ?1 P% I% r7 q/ H7 Z( o2 @) o& ]
  68. dma_addr_t dmaphyssrc1 = 0;
    ) k/ K5 |" x0 S3 q3 M3 {
  69. dma_addr_t dmaphyssrc2 = 0;
    0 _6 q# |4 m- {. g' b8 b
  70. dma_addr_t dmaphysdest1 = 0;
    0 e5 `0 Y+ S* h) x+ E) q3 N( o
  71. dma_addr_t dmaphysdest2 = 0;9 V" x0 X) I; J. N2 W
  72. , i  k3 [. c' L
  73. char *dmabufsrc1 = NULL;
    4 y8 ?& g& r$ ^3 ~8 \& s$ a
  74. char *dmabufsrc2 = NULL;
    , B  C! L' L$ s1 I- p$ Z
  75. char *dmabufdest1 = NULL;* M$ F5 E7 l2 f$ r* O& `8 A
  76. char *dmabufdest2 = NULL;
    : z! h, Z9 g4 r
  77. ( i3 c) u( Q) X# M" L0 q+ p2 I
  78. static int acnt = 512;
    , ^( z, _* |4 X# d( x  C
  79. static int bcnt = 8;& c8 Y& L7 m8 ~. W% |, C
  80. static int ccnt = 8;# G' R* ^3 b/ D$ a# b
  81. 5 c! v! o4 s0 D1 p
  82. module_param(acnt, int, S_IRUGO);
    8 \" @1 u- r  R3 n0 C
  83. module_param(bcnt, int, S_IRUGO);
    , `2 P2 c5 E: ~0 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# Y2 U, H. W3 w

3 u) n% y* l0 Z9 y/ Y7 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& w" I$ g% t% q* g4 T, qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 N: O9 p; H( E  R0 K. C  B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ^6 G2 f& d2 Z9 `) g! Y

. w" n; b6 r& \/ W4 x: h7 h1 P% Z' x! U& G2 ]. U+ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 21:22 , Processed in 0.038503 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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