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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 h. u5 G2 J+ b& k
  1. [code]EDMA sample test application  K; L) i2 H- d, B' `
  2. /*0 ~5 ?& V  q- Y  H
  3. * edma_test.c
    , E; R0 @2 E! Q3 \8 d3 {
  4. *
    0 m% N! \4 q" ~- W& U% k
  5. * brief  EDMA3 Test Application
    6 Y' z, f$ d& P( ?+ @2 w
  6. *& K# M/ W' s8 p2 i2 l
  7. *   This file contains EDMA3 Test code.
    : I6 x' I4 t3 p8 d' F) t
  8. *
    5 w5 \) _8 g% p3 c7 P1 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 o4 P# c3 J( B- m5 \3 B1 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 Y( T) v1 N1 `8 Y" K% W4 D
  11. *         TO CHANGE.
    ( C# F7 ]+ T4 f3 w2 N
  12. *
    7 [5 q$ l' H1 Z3 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ k9 k: U( r  q5 y# J! P4 L1 U
  14. *
    & Y" c0 i/ w& u
  15. * This program is free software; you can redistribute it and/or* c$ o9 i% |8 \/ y% s$ H& G
  16. * modify it under the terms of the GNU General Public License as% h  a  I% j4 O9 A
  17. * published by the Free Software Foundation version 2.1 Z4 d, j4 u) X% f- ~% |' n
  18. *
      S/ t: X' a% V- f& n9 d: O4 U2 U4 b% W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / f% }7 O0 Q$ Y6 W# X  x& }* t
  20. * kind, whether express or implied; without even the implied warranty$ P* J4 D+ [, }6 p! O& e1 h7 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# A" h" R# f9 M) h
  22. * GNU General Public License for more details.% d& |! _( |5 @
  23. */
    ! b5 ?5 J5 d  N

  24. 9 [( a' n) Y5 J4 q  t; x
  25. #include <linux/module.h>' m! Y* e0 ^; o, W' u
  26. #include <linux/init.h>! u. g1 f0 x5 }4 ]( F/ ~+ D, L5 I
  27. #include <linux/errno.h>$ `* r+ h% `$ g/ \
  28. #include <linux/types.h>6 S; |' v( O5 O3 p2 h
  29. #include <linux/interrupt.h>; }+ L+ |% |8 j
  30. #include <asm/io.h>) U; T6 D* N/ o8 Z, u# M- A. ]
  31. #include <linux/moduleparam.h>; f# y5 V* K8 m2 r8 L
  32. #include <linux/sysctl.h>$ _; J8 K: A+ G5 q, B0 ^  z
  33. #include <linux/mm.h>, F5 x) h, D5 B, ~! b( i
  34. #include <linux/dma-mapping.h>$ T' j% A7 G8 n4 r' H) t1 }7 h
  35. . U3 G2 c9 E7 o; Z% Q, I: l
  36. #include <mach/memory.h>8 Y4 D. b# L2 _; o- y% N
  37. #include <mach/hardware.h>4 J; U* d* ?: j7 j9 ~
  38. #include <mach/irqs.h># ?7 k; i9 Y. C+ u* H% C, {
  39. #include <asm/hardware/edma.h>' k9 A, d* a! M1 A7 r- ]
  40. $ O( r, C" J; E$ n" ]3 Z
  41. #undef EDMA3_DEBUG
    ! ~0 l4 C$ o* C- W; m8 ?- D7 N# [
  42. /*#define EDMA3_DEBUG*/
    & O5 ~6 @1 y8 v& F  y
  43. . |+ ^- G: M) l; T
  44. #ifdef EDMA3_DEBUG/ ~; j3 o# W4 N) R* U+ T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) l/ ~; z* e) i8 I. H& c9 \0 A/ o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * B. E& Z& l. H9 [5 k: ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) p7 h0 U. A( Z1 t# ^
  48. #else% y3 A' v; [9 v" B; m8 P
  49. #define DMA_PRINTK( x... ). r% ~+ J4 s9 Q) U$ I# j+ k( i
  50. #define DMA_FN_IN
    . A3 Q5 |: ]7 Z# v0 w8 T
  51. #define DMA_FN_OUT
    3 ~6 H  S. b) i0 Q, K: c/ Q; |
  52. #endif
    ) j; V6 C; D0 L" H

  53. 3 n5 ^6 D  E0 V; o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # p! C# q* I# Y0 e0 x: x
  55. #define STATIC_SHIFT                3
    , l( N7 Y0 D6 U2 C
  56. #define TCINTEN_SHIFT               20
    $ U+ O- h, Z5 }- s% M
  57. #define ITCINTEN_SHIFT              21
    $ ^/ v* |, r' D$ k
  58. #define TCCHEN_SHIFT                228 p; z9 R0 U' q9 M/ L
  59. #define ITCCHEN_SHIFT               230 ~; I6 G9 w; Z* f) D5 m2 ^- B1 W

  60. ' H+ y, e) F; y) n  X6 J- v
  61. static volatile int irqraised1 = 0;
    9 a0 h* w) i+ D
  62. static volatile int irqraised2 = 0;5 K" G* P4 L  c; Y6 |. Q  q( a$ X

  63. 5 i2 v. b$ a  Z- O* m2 `; e" F2 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # e# b+ }4 H" @$ Z' `( f- \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; z  j' o6 i, ]' u8 w- J1 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 V! f+ f6 k' f0 S6 Y5 h/ o
  67. " B: Z3 K) O7 a/ H" I1 [
  68. dma_addr_t dmaphyssrc1 = 0;
    " n" V' Z0 f2 n% Y" b8 F- |
  69. dma_addr_t dmaphyssrc2 = 0;! H! m4 @, n: u, ~+ M8 k; {0 l
  70. dma_addr_t dmaphysdest1 = 0;4 _  c7 c# E5 C& W* Y# ~( W
  71. dma_addr_t dmaphysdest2 = 0;* j( ^2 c8 x6 F; c7 c

  72. ! k8 o- y+ L2 m6 H
  73. char *dmabufsrc1 = NULL;" h( h1 l& F0 S+ `
  74. char *dmabufsrc2 = NULL;5 d. {1 Y' p* P+ Y& K
  75. char *dmabufdest1 = NULL;; ~/ v1 Q' m. f% O( P$ E  E
  76. char *dmabufdest2 = NULL;
      O7 f# w! w+ B1 m/ `7 f7 l
  77. 1 c9 Q; R4 n  i$ F+ I
  78. static int acnt = 512;3 ]- C# |" W4 E
  79. static int bcnt = 8;
    9 |3 d6 O! h; ]  E$ D. l( W
  80. static int ccnt = 8;5 i; O: }2 E0 B& _! B/ r$ X8 {

  81. : c8 S; H" d' }7 @" h
  82. module_param(acnt, int, S_IRUGO);
    3 h4 G( \. }' T+ \
  83. module_param(bcnt, int, S_IRUGO);0 A5 s" c" ?  O" Q9 w1 E# }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 k& a: k# x3 p% h
/ {3 l* Q% N4 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 w: z, K' T. u  c* d$ B7 S6 karm-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: E5 B" W% q0 R, r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ @0 H% j! w7 r/ d0 j0 C

" i) D; T3 e3 U# m/ v/ k& J& @. D9 h; ^; |( c% @. e( W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 04:20 , Processed in 0.040014 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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