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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- G' z, \0 e9 m  m$ y$ I; H/ q
  1. [code]EDMA sample test application8 R! s0 l. Z: F; y/ q
  2. /*
    7 I! B  N5 B( [4 f, w
  3. * edma_test.c
    % u" h9 {7 ^1 V1 }" t
  4. *
    , Q, \% G. ~4 b
  5. * brief  EDMA3 Test Application4 i7 T: k5 h8 E# s8 \
  6. ** t0 [3 J$ m$ q% n2 ?
  7. *   This file contains EDMA3 Test code.4 g% B; v/ g; B$ H) X: N& Z
  8. *
    4 l6 {& J7 W0 I- c. }+ C6 I8 W8 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & [0 i; C" @5 {0 W. E8 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 G# m( ^; e0 }+ x# T/ Y
  11. *         TO CHANGE.
    : q5 i, ?4 Q, C1 y6 {' U+ ~
  12. *. v1 @6 e( E( m5 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 x6 @% a$ e$ x4 u  v
  14. *5 b' t+ {+ d% |1 t' u; u" p
  15. * This program is free software; you can redistribute it and/or
    ' C7 S7 a4 S8 V
  16. * modify it under the terms of the GNU General Public License as
    * y% t( U# v2 x
  17. * published by the Free Software Foundation version 2.
    8 W7 e0 E9 @5 R$ H6 k/ j1 @9 {
  18. *
    . g) t" K. K* b7 `: Z. F2 ?3 h5 |9 _/ w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! @% a5 k0 u% J) n/ {
  20. * kind, whether express or implied; without even the implied warranty
    - E& t# @# m% c# C9 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 ]! C- B  G  }5 j
  22. * GNU General Public License for more details.
    - Z4 Z2 N9 {* P
  23. */
    1 [. f5 `% O/ |8 Q( ^
  24. 0 E/ P4 Y% i1 c( L
  25. #include <linux/module.h>
    : d% D8 r. t, N: }- ^
  26. #include <linux/init.h>7 y& H; V9 N/ y! H9 s* t$ {/ @2 w- d+ e
  27. #include <linux/errno.h>
    6 S$ f" ^. u$ V4 h; b5 k3 W, ?) I
  28. #include <linux/types.h>* k0 p9 w" t! g1 X% h
  29. #include <linux/interrupt.h>
    ! P5 y6 u$ n: ?# ^- F: y
  30. #include <asm/io.h>& o/ X$ R2 Y* T6 C! e7 Y
  31. #include <linux/moduleparam.h>1 p( Q% Q# |* Q) k
  32. #include <linux/sysctl.h>
      M0 u1 ]% Z& n9 m+ _% d
  33. #include <linux/mm.h>
    + Z. q5 s: Q3 A5 w& r% C! O
  34. #include <linux/dma-mapping.h>
    1 H5 A" P; W9 q0 O" z: F1 A

  35. * f% Z2 Y/ [* ~- X7 g2 P) @
  36. #include <mach/memory.h># c" m6 r$ Z* n. ^
  37. #include <mach/hardware.h>+ b7 Q: _) o) F; N* E1 o
  38. #include <mach/irqs.h>- X/ Y3 M0 i3 d5 q4 `8 e$ r1 W& j% H
  39. #include <asm/hardware/edma.h>
    * c/ a* z  U1 y5 B) s) \/ O  O# b
  40. 9 M/ V* T. W( R# t
  41. #undef EDMA3_DEBUG
    - |6 c) |$ S5 s; i  k; _! n
  42. /*#define EDMA3_DEBUG*/8 X  m  w/ r" R) ~) X7 X( S. P2 Q
  43. , A" p. b+ u  Q) Z: L
  44. #ifdef EDMA3_DEBUG
    . g) p4 d( z! w0 t! i# v7 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( f8 f" B7 s, l& p7 i4 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 a5 L% n+ z9 P7 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ x$ d) c/ s7 j0 ^( P4 M' O" }( ^
  48. #else5 M1 x5 k. f! o* ?
  49. #define DMA_PRINTK( x... )2 ^# m0 M# J4 d0 E! F. J& m* W
  50. #define DMA_FN_IN" Q  \% u! |' \# L, P$ Q7 ?
  51. #define DMA_FN_OUT$ e' }( P: a2 i" f" H
  52. #endif
    5 ]! u6 M! q4 g  z: I3 D

  53. 6 q3 o6 \8 j9 E1 G) o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 R! u' r& \, k
  55. #define STATIC_SHIFT                3' ~0 }/ L+ c6 W% l1 P4 Y% _
  56. #define TCINTEN_SHIFT               207 p: @' Z) z, |! h: s
  57. #define ITCINTEN_SHIFT              21
    " E: c  C# a$ R) R* }5 R
  58. #define TCCHEN_SHIFT                22
    . c: E7 f" Q: Z. |; J3 \9 U
  59. #define ITCCHEN_SHIFT               23
    ' f( e, ?% Y7 l
  60. 6 ]* H8 I7 p5 ?! }  T  ?  @
  61. static volatile int irqraised1 = 0;' e1 F% H4 o+ Z. s
  62. static volatile int irqraised2 = 0;
    ! F- R: `2 ^: Y' V4 ]

  63. ) M# o* I! b; ~) H% @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r0 m7 V7 c2 l: B6 }  G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \) o% ~2 ^# b) F( p, p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 w6 U: r; J, S* x
  67. * u& X1 J" k5 B
  68. dma_addr_t dmaphyssrc1 = 0;+ Q$ w: Y( s+ v# F- q' B) k
  69. dma_addr_t dmaphyssrc2 = 0;$ a( V# o! ?  r5 {
  70. dma_addr_t dmaphysdest1 = 0;
    2 P4 `1 u% y' l: @' f( Z* M$ Z& r
  71. dma_addr_t dmaphysdest2 = 0;
    " Y  Y' Y2 `* \0 f/ J8 p

  72. , S2 V( y; t2 ]* Q' `. ~( ]! G- P' n
  73. char *dmabufsrc1 = NULL;$ u% @6 V, z6 q9 q7 G8 j, B
  74. char *dmabufsrc2 = NULL;$ n5 l$ ?2 w# y8 x( b0 o
  75. char *dmabufdest1 = NULL;
    2 R; s6 N, p3 O  }' I
  76. char *dmabufdest2 = NULL;' D' \; [2 K8 \9 c- z/ e
  77. 6 ]7 W* G6 x  t% B$ l9 g3 W
  78. static int acnt = 512;" N6 r/ r- t9 Q& N& G/ T8 E& t
  79. static int bcnt = 8;, K9 I; v' I/ j9 Z
  80. static int ccnt = 8;" ^4 i7 p) W! A+ O% i
  81. # D0 R' c2 V! e! j
  82. module_param(acnt, int, S_IRUGO);
    9 o2 N! h" o5 V2 f8 U1 B9 y, N6 O
  83. module_param(bcnt, int, S_IRUGO);
    1 A) l( D2 l! a: |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 t9 ^+ R' w- ^# v  ^
- H# m$ C. y: |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 A, {1 I$ _. Y! j% X1 h1 i
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 t! O, ^* q$ e0 f+ U& j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ~; Z  K+ L( G
6 O; ^7 O3 K% W& q$ C
+ [' n+ L& u) D% O6 V! i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 16:11 , Processed in 0.038563 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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