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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # J* u# W- w4 d; }) J- k
  1. [code]EDMA sample test application0 U/ u7 M: Y' u
  2. /*+ a  c$ y" o/ z" G; c
  3. * edma_test.c
      n- z8 ?, j, C8 p: k) J, i; t
  4. *1 W' l) _& G% v: W7 v0 N. @7 v( }
  5. * brief  EDMA3 Test Application! {) N% g; d, M& k# L6 d# b
  6. *  d0 ~6 n$ X/ D0 `- C$ E3 M  k
  7. *   This file contains EDMA3 Test code.! c1 D& d4 P5 r! D) d
  8. *
    6 D6 n4 _5 T0 H6 i7 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , E* e7 O5 u& y. G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 v! {4 C9 W7 G3 N9 h
  11. *         TO CHANGE." Y0 a1 j, l; {% X3 ~7 w! P$ Q
  12. *
    , L. W" }1 m/ z0 H- M4 Y/ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, B: U& E( \9 g( H: m
  14. *
    6 T' q9 _6 S" D  h# X
  15. * This program is free software; you can redistribute it and/or: p1 |5 h4 }, ]  T
  16. * modify it under the terms of the GNU General Public License as
    / O6 E5 V7 I6 @+ B7 H0 O9 X: H
  17. * published by the Free Software Foundation version 2.
    ) g0 N, W* b+ E6 h. E' |7 m
  18. *
    ' Z/ m0 o; p( {) M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " v* h( J5 r- c- f8 o& h" k' a' a
  20. * kind, whether express or implied; without even the implied warranty
    5 I) P4 @! v7 x8 s: D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. \" x+ b" [: Q* `" ^' l
  22. * GNU General Public License for more details.
    : ]5 ^" c$ R% |* r9 ~4 o
  23. */
    9 {; `" N! @, i. h

  24. * j" u! I! W; p  Y$ U4 k
  25. #include <linux/module.h>
    & i& S7 _# P/ ?# X* e2 E
  26. #include <linux/init.h>/ G+ B  |' n+ {! l$ l  n4 h- {
  27. #include <linux/errno.h>
    " Y4 g5 B. L. Q3 s1 H
  28. #include <linux/types.h>
    # ?" Q8 p$ }- W% ?
  29. #include <linux/interrupt.h>
    0 G4 K; I+ I7 X; F9 {
  30. #include <asm/io.h>7 j" H. M4 s/ ~8 K/ E. H
  31. #include <linux/moduleparam.h>" z9 u$ P- Q4 q0 u
  32. #include <linux/sysctl.h>
    % c  n3 J1 B3 \! L. X
  33. #include <linux/mm.h>
    + q. M/ I3 \# c4 K  f; T" M
  34. #include <linux/dma-mapping.h>
      ?2 d% @9 K# ~! u& d
  35. 0 e$ j' e- R. H& G
  36. #include <mach/memory.h>
    # `6 R2 t4 C8 C8 q3 n
  37. #include <mach/hardware.h>
    ) G, N8 F; h0 M4 ^9 T
  38. #include <mach/irqs.h>
    & R: J) p  t* x) J
  39. #include <asm/hardware/edma.h>
    + x1 Q) p3 E( r  H

  40. " J7 c# E/ c" ]/ Q; Q
  41. #undef EDMA3_DEBUG
    - ~  x2 ~# J! i
  42. /*#define EDMA3_DEBUG*/0 ?& F' F) \5 \9 _/ S$ g/ ^# o
  43. 8 W6 R% p5 f/ C' z( ^
  44. #ifdef EDMA3_DEBUG
    , v1 V$ L- v& R5 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 r1 t2 |+ w( b8 ?- C: c: \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); k9 U! ^+ u' F& ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" a6 ~2 o  y7 }
  48. #else
    & ^# I7 ~7 ]$ U/ e% K9 H
  49. #define DMA_PRINTK( x... )/ V' n+ C; X8 B+ v5 ?' E1 H
  50. #define DMA_FN_IN; S2 L, {! c2 ^3 D% S$ z' O. g
  51. #define DMA_FN_OUT+ r5 P! r6 ^8 M0 L5 k# a
  52. #endif, u4 V1 p/ O& D8 q

  53. ; ?. r: p8 A! n1 F7 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  X' [* v$ b8 ?" n$ q6 I( ^
  55. #define STATIC_SHIFT                36 r% F5 W+ ~  d; a+ g
  56. #define TCINTEN_SHIFT               200 Z" |* e2 _; t7 B* v
  57. #define ITCINTEN_SHIFT              21
    ; D9 f/ a( V" x
  58. #define TCCHEN_SHIFT                22
    5 ^9 `" ~6 s5 K1 i  \0 Y& p
  59. #define ITCCHEN_SHIFT               23; d. h% k* W7 i
  60. 6 C: t8 x% _0 C, Q6 f
  61. static volatile int irqraised1 = 0;
    7 P  ~% d( L& k# r9 I' C
  62. static volatile int irqraised2 = 0;6 e, M( ^- A0 D' |% n' j  O; I3 q
  63. & V' M! I: ?; b* g; n6 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 F- E5 ^. g3 @* E- [& F' S5 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J" Y+ p' ~$ U; y' n6 p) y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 E9 M" ~  _7 R: j$ y. P

  67. / {% P$ @  a7 M5 J* x1 a. O8 A
  68. dma_addr_t dmaphyssrc1 = 0;- X; [+ a7 R: |& o3 f: v
  69. dma_addr_t dmaphyssrc2 = 0;
    % R4 q" M- X$ Y% K$ L
  70. dma_addr_t dmaphysdest1 = 0;1 W  `: J5 m  w8 D- e: O
  71. dma_addr_t dmaphysdest2 = 0;
    ' Q, C0 q. }7 i5 A7 K
  72. ! m1 f/ g" s* q2 l- B) C
  73. char *dmabufsrc1 = NULL;
    ! w& b& H8 d4 p
  74. char *dmabufsrc2 = NULL;
    0 S! B. o4 ?/ R  F- s
  75. char *dmabufdest1 = NULL;- S4 b2 x8 E# {& h! i" F
  76. char *dmabufdest2 = NULL;
    8 j. o+ i" i* A7 n/ f3 K# U' S9 c

  77. 9 y! _' P5 Q. k) M& A
  78. static int acnt = 512;
    $ t' Z2 A) f8 x
  79. static int bcnt = 8;) A9 L  Y) D% h1 {3 |. t
  80. static int ccnt = 8;
    / ?4 |' v7 R4 T' f! m! E& e
  81. ( |4 H3 D8 R0 U5 {* S
  82. module_param(acnt, int, S_IRUGO);
    ( p! K& s; Z/ Y) P; g! L$ D) U
  83. module_param(bcnt, int, S_IRUGO);
    ( a2 G6 k& D% l3 o' H& p. i4 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; Z; E% {1 g- m$ ]$ L1 }3 w& Q
( L3 i, n# u) y  ]* j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 N  W" a' q% k1 Y: uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 M& u6 L, K+ }; i  z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 l& M  Q- l% D
8 l9 V$ ?# ?+ R% f
! W6 _5 K2 I0 _/ U! |, i+ C' |0 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 01:49 , Processed in 0.041544 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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