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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + S" O4 J. Z2 z# h* Z
  1. [code]EDMA sample test application3 V0 o' P' F# _& l( U. u9 M3 z
  2. /*
    8 t+ S- X! h  ~2 `: I0 p
  3. * edma_test.c
    ' x. i' P$ Z1 r
  4. *
    : {) B5 z9 H" |+ `% A
  5. * brief  EDMA3 Test Application
    + V  @8 D& {/ ], I" T. p
  6. *2 P' ~5 T: `2 ^4 o/ K7 W% [
  7. *   This file contains EDMA3 Test code.
    # [. c* Y* f5 N+ J
  8. */ d" c8 i( w/ G4 {: }. ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, Q" J5 C2 E9 p5 g7 Q7 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 c! c: ?. J: \
  11. *         TO CHANGE.
    + b/ Z/ m2 a) P. `: ]
  12. *4 A% X1 {; j* \- u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" {( M7 e, j* P& r6 Q4 R/ }
  14. *$ R6 a* c7 I- X9 g8 F: X" y9 L
  15. * This program is free software; you can redistribute it and/or
    # O, o0 n" A" U& [
  16. * modify it under the terms of the GNU General Public License as
    % ]. N9 O# Y/ a- V  v& U  ]
  17. * published by the Free Software Foundation version 2.# U, S: m4 i/ \& X) T% k
  18. *( g! f3 D* W" q% G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& c1 o+ T% g! d* q+ Y
  20. * kind, whether express or implied; without even the implied warranty
    ' D" G/ k7 j- b! I) h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , d% J! q, a& x# a0 `
  22. * GNU General Public License for more details.9 C- A* T) y/ W7 k- N
  23. */" [( n+ g0 |/ h3 Z/ E$ U
  24. , u  j+ N6 f0 c0 F6 T5 B9 O1 V
  25. #include <linux/module.h>; R5 x3 v, l9 U- M" {! d
  26. #include <linux/init.h>
    5 G/ A4 S1 H0 M" @; P
  27. #include <linux/errno.h>: O5 i. i$ M/ v" k/ A
  28. #include <linux/types.h>
    - o& @- s5 g, t' l% v7 Y" B
  29. #include <linux/interrupt.h>. O- g* L; u8 o- J
  30. #include <asm/io.h>
    ' _6 f( L# D1 e% r
  31. #include <linux/moduleparam.h>
    4 Q8 s3 v/ k, G5 u) p
  32. #include <linux/sysctl.h>5 n1 N- V$ K& l
  33. #include <linux/mm.h>
    " y+ F' n7 v# Q: J# x8 Q+ [
  34. #include <linux/dma-mapping.h>4 P1 W9 v! g2 x; E# A, @* _+ L

  35. ! E0 }- K/ Y8 \4 a
  36. #include <mach/memory.h>: X) R* e: V2 z7 {  S
  37. #include <mach/hardware.h>+ s' p: z, x: c% L. _& s
  38. #include <mach/irqs.h>- M4 i! ~3 Y1 L/ `' H
  39. #include <asm/hardware/edma.h>, y+ R7 t8 _/ |
  40. + ?! `$ M. |1 k+ J, l
  41. #undef EDMA3_DEBUG
    4 ^; k/ p% H( @: b) l1 [% H' n
  42. /*#define EDMA3_DEBUG*/5 s4 `  b& f% P, _$ T
  43. & k$ W! M9 e  T& g
  44. #ifdef EDMA3_DEBUG: H% N# {7 a& T$ X  r4 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 Y0 u: w, \8 n& n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - B9 m+ C' ?$ g2 z$ b6 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) I- }5 ], R! [  D
  48. #else- Y, o" _$ z: K. m+ O2 M% i) [
  49. #define DMA_PRINTK( x... ), F+ ~8 W" q5 f: N0 \
  50. #define DMA_FN_IN
    ; k3 F  w* K4 }# f8 q  M8 O
  51. #define DMA_FN_OUT
    6 P/ Z- R8 {$ }$ _0 s
  52. #endif0 d8 N9 z, r: l, |, ?( a

  53. ) A* q' o5 x6 k1 Y4 a6 G9 E; E/ X1 z8 [' B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); _2 x+ N9 q9 M; u/ ?: ~, X4 {  ^
  55. #define STATIC_SHIFT                36 E$ m3 {0 O$ U2 n
  56. #define TCINTEN_SHIFT               20( x- I* p. d: G9 |5 Y7 o) x
  57. #define ITCINTEN_SHIFT              21
    1 C6 X# g6 f) k: A2 _
  58. #define TCCHEN_SHIFT                22
    0 u& b& u* }- _2 P2 I: h: a
  59. #define ITCCHEN_SHIFT               23
    8 M  o# y' F& b% t
  60. 5 ]3 j3 I; \6 n
  61. static volatile int irqraised1 = 0;3 L# V/ X' T8 }
  62. static volatile int irqraised2 = 0;$ R  }2 t7 V8 R) W

  63. / X" A8 m3 t2 U# ]$ |: y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ?% b; A2 B7 R# x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / g1 V9 T1 Q! @6 m3 O3 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 }0 P, x! B8 T- h7 C0 n

  67. 4 N. H5 |+ b1 H4 E" R% K; [
  68. dma_addr_t dmaphyssrc1 = 0;9 F; N  F' h* s
  69. dma_addr_t dmaphyssrc2 = 0;
    # C: K1 A* D& q1 @9 g0 x4 v3 V
  70. dma_addr_t dmaphysdest1 = 0;
    # |% ~. O% x4 U: c/ {' k9 w. [
  71. dma_addr_t dmaphysdest2 = 0;; z4 T4 a9 j  S6 s: C5 Y8 W
  72. # c& j9 U0 ~/ P0 n
  73. char *dmabufsrc1 = NULL;
    + u# _2 K' ^" p0 T0 D8 G* ]
  74. char *dmabufsrc2 = NULL;' I+ g" l9 {# s' Z1 l
  75. char *dmabufdest1 = NULL;
    ) f  B5 Y' a$ t: u8 q
  76. char *dmabufdest2 = NULL;" \2 X% E) D5 M. s( T

  77. ' o( K/ l/ r2 t: K, P' s+ H% _
  78. static int acnt = 512;
    ) h0 A2 N: ^' T7 H& G
  79. static int bcnt = 8;
    0 `) A9 {8 v7 f/ S# T
  80. static int ccnt = 8;5 K; ~8 f- m) F
  81. % H5 z) E( K0 g3 N, w) y
  82. module_param(acnt, int, S_IRUGO);
    ( l+ _& `0 O* h9 n  A
  83. module_param(bcnt, int, S_IRUGO);
    . H; C/ ?7 v3 x' ?& e7 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 j" `( N* D$ |2 i2 U% A' F% u; ]
  ]) s+ j+ ?2 c! u# ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 Q# i$ I: `8 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 a2 b) x/ N. H0 G1 F( T/ ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: x' P, \# ^4 ~: X
# b+ j/ ?& _+ k

4 W+ Z2 }2 x1 \+ ]/ x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 14:38 , Processed in 0.039540 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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