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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 _7 D% T- U; @# y8 D+ i% a% N0 n' p
  1. [code]EDMA sample test application) m& m. L5 a9 ~3 m
  2. /*1 r6 y! `! }/ E' \$ a$ ]- v! E9 L
  3. * edma_test.c( I! r/ s% }: a1 t4 J1 K
  4. *! i5 V# z# i8 n4 j. _: U
  5. * brief  EDMA3 Test Application% b' z8 S# T, h
  6. *
    + {7 V1 I  k3 G  F0 u
  7. *   This file contains EDMA3 Test code.
    ( W8 P) X' j, z$ b6 x/ f  r
  8. *7 f* G4 v  N& ^# ]! _3 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . q% N* n* y2 D! \1 S3 {: T) o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* x2 I$ K& c$ d$ J
  11. *         TO CHANGE.
    8 V" Z, p4 r7 l; e" K) B
  12. *
    ( I9 J5 I# p, }, H# s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. q, c4 B: b  t. V
  14. *
    5 W$ D3 Z# y4 w% E/ \* T* j
  15. * This program is free software; you can redistribute it and/or1 n" ?+ @3 ?5 v' y  f6 S
  16. * modify it under the terms of the GNU General Public License as, f$ `1 j' ~/ C; L, P% Z( M
  17. * published by the Free Software Foundation version 2.
    . @2 G' d, U% b% p. l; L9 r) e
  18. *& O# L, L+ N' n1 G! K5 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : B1 G# n2 _; M8 h0 Y- W# J
  20. * kind, whether express or implied; without even the implied warranty
    - q6 j3 G+ v0 I3 g; S* ]7 G7 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# ?, T( ^, m! a6 X; t
  22. * GNU General Public License for more details.
    ! f) W. j. G0 Q; N! w7 ]
  23. */
    % D& b7 f8 g! X1 M! y& F

  24. 5 m" F; R% G* A) i% P
  25. #include <linux/module.h>" ?! J  ~7 n2 u
  26. #include <linux/init.h>0 R/ {5 h7 j7 _6 P. _
  27. #include <linux/errno.h>
    7 G/ Y; o% c2 D, ]
  28. #include <linux/types.h>
    6 }  ~8 y  G$ W6 R  ~# i
  29. #include <linux/interrupt.h>
    9 R- V+ q2 M9 g! U. Y$ Y
  30. #include <asm/io.h>3 U' l, L4 H; f
  31. #include <linux/moduleparam.h>
    6 M' b, s( Z, q9 h0 k' l
  32. #include <linux/sysctl.h>. A5 A2 ~5 C9 w& V
  33. #include <linux/mm.h>
    / w, r2 D! v2 }; z! B2 ^; n
  34. #include <linux/dma-mapping.h>/ n# k( r( E6 D8 O, P) D6 _
  35. ) L1 Z% _- Z" F; A  H1 b& Y, V
  36. #include <mach/memory.h>; C/ W) W5 d) u' \2 C  I. c
  37. #include <mach/hardware.h>6 [) T" W+ r( D- J6 B
  38. #include <mach/irqs.h>- L/ r& V6 i2 N! R$ i( ^; `0 |7 ~# G
  39. #include <asm/hardware/edma.h>
    2 d0 I, t2 s% P" g  Z
  40. ' f* W. p) Y+ F" {9 v
  41. #undef EDMA3_DEBUG' b) n+ }- S0 e& `* ~/ x+ c0 G2 ]( c# O, F
  42. /*#define EDMA3_DEBUG*/
    * M4 q# r: ^2 m* a! S4 q5 @
  43. 7 Y+ }; S/ Z# P" e$ R  ^, t; W
  44. #ifdef EDMA3_DEBUG
    / \  r7 f' M# G) o$ h7 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* Z/ ~1 O% J0 F5 c( `  G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & c4 V$ s5 o  f1 X0 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # D; H( C! ~; y; v8 Q; U
  48. #else  R  ~! g5 c! P$ j8 F
  49. #define DMA_PRINTK( x... )
    9 _% p) [; L8 ~# \% B
  50. #define DMA_FN_IN
    6 a& L7 s- E% h
  51. #define DMA_FN_OUT! P6 u8 Y  ?( b& \# @
  52. #endif
    ) D5 G. s! l  J( ^

  53. 5 `/ p: ~% b# c* Q. J2 y+ Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( J0 m5 p; _7 q( m: j
  55. #define STATIC_SHIFT                3
      z& ]% q7 E4 W* z! K. A
  56. #define TCINTEN_SHIFT               20( U' I( T. R' l1 g
  57. #define ITCINTEN_SHIFT              21  q' [* O7 U. c+ W
  58. #define TCCHEN_SHIFT                22
    2 P& e4 r3 x  t! d" ]2 L3 U- Z
  59. #define ITCCHEN_SHIFT               23
    , a& q# ]2 D* k. j+ \+ u7 E; A

  60. 3 @8 h' U) m3 c( ]0 l
  61. static volatile int irqraised1 = 0;
    8 P5 e  z2 Z% g9 X7 f- D- t; D2 J
  62. static volatile int irqraised2 = 0;
    ) O+ \6 V1 }8 ?4 Q: Y  K/ r
  63. ( }/ q% `) b/ A$ E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F& l+ e" k/ ~' v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 m- U$ ~5 G" R# q% w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a* ^* G0 ?4 X; c% h$ G% \
  67. $ i0 h1 T9 A8 X3 ~6 d
  68. dma_addr_t dmaphyssrc1 = 0;
    4 c* n( @- ^* B7 i% y" N
  69. dma_addr_t dmaphyssrc2 = 0;/ P9 i! c6 i9 ^9 K- r, K
  70. dma_addr_t dmaphysdest1 = 0;
    : u! Z, c) H. }6 \5 O. z$ ?
  71. dma_addr_t dmaphysdest2 = 0;
    # m! I3 j# _: Y, i1 Z  k
  72. * ]8 a1 \+ O4 c9 u( b' y
  73. char *dmabufsrc1 = NULL;
    4 A4 N: T8 P/ N; c' y
  74. char *dmabufsrc2 = NULL;& m7 A4 x, y, I- r
  75. char *dmabufdest1 = NULL;) ^6 ~( W/ [2 y' x5 ~" n: I
  76. char *dmabufdest2 = NULL;" @$ }# P7 K& W3 Z

  77. 6 a' r2 C7 u4 l5 R
  78. static int acnt = 512;
    & O$ Q* o" I! \' w9 \5 R
  79. static int bcnt = 8;8 A' t# J! m2 {8 M1 }) z. g. g; w) E
  80. static int ccnt = 8;# z" [  `: [( P# K$ p
  81. 4 k* w4 P: I- W3 \
  82. module_param(acnt, int, S_IRUGO);& e/ i$ k0 A; ~
  83. module_param(bcnt, int, S_IRUGO);
    & Y0 F% U+ a1 d1 B! }+ ]) e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- y* o$ M- E! N# ^& H. Q- Q0 v
6 D; ]6 ?# L9 p% f$ f7 R  R6 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, P$ O4 s. t6 w  x: H( h! [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 f$ D! z! l$ j# C6 {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" f" b$ R* j6 v$ B4 v
4 U5 M5 ]- F- G9 z
) Q+ [6 \1 `  Y. R9 L" b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 16:32 , Processed in 0.043528 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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