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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) D0 @' `' b6 l! O$ ?0 k$ \
  1. [code]EDMA sample test application
    3 K  V: W8 p# N' F+ q( {: g# @! `
  2. /*8 f* A+ |  b! s
  3. * edma_test.c
    ) G8 Y+ }9 _$ U
  4. *
    ; ?' Q  O: W. z" _9 O9 D# U% U
  5. * brief  EDMA3 Test Application
    + p% X+ m, h2 c* E) K3 N- L
  6. *
    8 s7 b- f) P' [5 \5 V
  7. *   This file contains EDMA3 Test code.
    + ~7 ^+ [& y- Z4 Q& o) W' G
  8. *
    : d% J& H; I, V, s$ l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 @3 S6 v5 ?- z0 L0 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 z/ n2 ~$ Q3 f  ?. ~: M
  11. *         TO CHANGE.$ m( s) A1 t& h/ b& p9 Q$ M
  12. *% `% Q: v' z5 |9 W& v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* {$ J# ~6 _; ^3 ^
  14. *4 [1 s( ^, K! s0 w5 S
  15. * This program is free software; you can redistribute it and/or
    9 A! T! Y  m; ]9 [2 G" _( s
  16. * modify it under the terms of the GNU General Public License as9 k" _4 ?8 x- \- t3 `: e* u
  17. * published by the Free Software Foundation version 2.
    0 i# `1 k6 [& C1 g+ |
  18. *' n0 l' d' Y1 {, X* ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! e/ ~6 E6 o' w- C
  20. * kind, whether express or implied; without even the implied warranty
    % t1 d7 J/ `9 B5 R0 n$ s! `& }- m7 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " @, _4 y, z% ]3 Q
  22. * GNU General Public License for more details.
    * g7 U8 c8 n% F
  23. */6 z) f1 Q1 P0 i5 i7 ?  I/ t
  24. 3 i$ t. o- K( Y9 x/ V/ b
  25. #include <linux/module.h>
    0 h  X, ^% R2 x. {
  26. #include <linux/init.h>
    4 S+ i4 E2 S% J# ]( m" Q0 p1 V) P3 R5 O
  27. #include <linux/errno.h>* E4 y3 i) A: [' |
  28. #include <linux/types.h>& D1 @( n- B- e* s
  29. #include <linux/interrupt.h>
    0 k( N& d% P, ^4 N& D8 \
  30. #include <asm/io.h>, R0 ?, k+ U; m% u, x7 x4 ?
  31. #include <linux/moduleparam.h># t+ f* F$ A- G, N; ?" Y8 ~
  32. #include <linux/sysctl.h>
    0 C0 T2 ^. F6 |# M
  33. #include <linux/mm.h>
    7 ^7 ^; k+ I8 @& |
  34. #include <linux/dma-mapping.h>7 A$ u& H& A  r& @8 T# l
  35.   K. |- q! Q& H' N0 F8 Y# g& P& D
  36. #include <mach/memory.h>* D, e8 y' J  W! A$ X3 ]. m
  37. #include <mach/hardware.h>
    5 R& m( ]; n2 C0 h. w2 Z
  38. #include <mach/irqs.h>1 a! U* D% y2 [5 h% A
  39. #include <asm/hardware/edma.h>
    1 h3 E* a3 K* W, f
  40. / J6 i; q. H6 Y3 x2 ]  K
  41. #undef EDMA3_DEBUG; l( }- t: J5 W+ ~; \
  42. /*#define EDMA3_DEBUG*/8 K4 r0 G4 W! ^

  43. " ~9 U# j3 D. ]
  44. #ifdef EDMA3_DEBUG
    3 S- v# I8 o  v! X% Q8 K" X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 x% P9 J/ ]/ a2 P9 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 [5 z; A& o6 \" O- x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; A" i# J5 J1 x5 o
  48. #else/ D1 o4 _9 r( A8 {( V% J  c; T4 m/ W
  49. #define DMA_PRINTK( x... )7 u  P8 s, a: Q; J8 y' N
  50. #define DMA_FN_IN
    - Q  N9 [# m5 S% V0 P  D5 v
  51. #define DMA_FN_OUT- N0 k" g$ Z. ?- _
  52. #endif
    3 H7 O9 r- _0 Z0 f+ S8 l9 M0 D
  53. , x, Z0 Q7 ~9 q$ N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 q- ]: B2 a2 ~: I( c1 f
  55. #define STATIC_SHIFT                3
    " N# J- C" g0 q2 _% Z/ r% A
  56. #define TCINTEN_SHIFT               20+ ^" ^# K& ^" J7 V9 L
  57. #define ITCINTEN_SHIFT              21
    ( C* W3 z: m3 N2 F
  58. #define TCCHEN_SHIFT                22
    1 M0 E% K8 g  U4 t# X& P$ V- B
  59. #define ITCCHEN_SHIFT               23. ?# u' }2 @3 @# b, L& D2 b

  60. + f& n& \4 v. p7 _
  61. static volatile int irqraised1 = 0;  Q; C8 C$ J$ G* _0 I$ Y
  62. static volatile int irqraised2 = 0;# e/ [- n! u7 X5 R% {3 M

  63. 6 f) R, Z5 a) X, v, K7 |" K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, \. `# g8 _! ?! S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" M4 t: `2 ~0 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P/ K* Y  P/ _% F  d" c

  67. " T, C2 Y$ D0 [
  68. dma_addr_t dmaphyssrc1 = 0;  @& V$ B8 }  g8 U7 }
  69. dma_addr_t dmaphyssrc2 = 0;
    / Q# M3 T7 n1 l+ j8 M. n0 K. D5 q
  70. dma_addr_t dmaphysdest1 = 0;9 z2 ^$ A5 _! U# t
  71. dma_addr_t dmaphysdest2 = 0;8 g8 \% H9 i3 K, [& ^0 b

  72. ) I# w: D0 q* R4 d
  73. char *dmabufsrc1 = NULL;
      q7 ?  Z; y  W; u
  74. char *dmabufsrc2 = NULL;
    * U9 ?, i) o" m; ^  w6 w! ~
  75. char *dmabufdest1 = NULL;/ @4 V  E! c7 R! E9 F
  76. char *dmabufdest2 = NULL;& V6 P7 s* M& e8 j/ V

  77. . N9 P1 B7 {, T3 q: E
  78. static int acnt = 512;
    , f& L  |! f5 S/ S- Q! _9 a
  79. static int bcnt = 8;
    % G2 P5 d' [* m, D7 g
  80. static int ccnt = 8;
    6 U+ q! z1 C5 q7 r* _) i6 g4 z
  81. % v; R7 W6 M2 G5 j( c) B9 h/ _
  82. module_param(acnt, int, S_IRUGO);
      ]6 ^; o) ^2 P9 S1 w: {+ s7 b
  83. module_param(bcnt, int, S_IRUGO);# c# T" r- @4 w' w* W$ `" y* i/ v8 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  L* O$ q. z! ^  T2 L, }* L

+ R. j0 a# |! M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, U4 l5 q' K& @$ g& {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 r, Z8 p: G' h4 T) j5 A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( ~$ R0 v% |7 W: \# E' A: H! W! L+ y. j; V, T
# }1 C  E1 b# l2 S4 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 03:04 , Processed in 0.039418 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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