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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 r: S2 u# O# {% T3 w! Q
  1. [code]EDMA sample test application: [# ~# k2 V/ Z
  2. /*& B# e7 E4 F' I) Y$ L5 z* Q& N
  3. * edma_test.c
    , D% h5 l! y) g4 J5 k
  4. *, V; Z# j- E' O' O
  5. * brief  EDMA3 Test Application0 p; o$ s* T0 l/ P
  6. *
    6 [7 R% I& a4 P5 X+ J; U
  7. *   This file contains EDMA3 Test code.
    - J+ N2 u) x* c! w# Z" _
  8. *0 `. x9 V$ q( U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / A! G$ D* q, Q7 g! Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & o6 y# j* C& c! J, ~4 c; Q
  11. *         TO CHANGE.
    6 t: A& W1 F% y" f6 o2 I% X+ E' v
  12. *' G: {1 O( G1 A+ T% L" Z/ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 r# L- i1 G9 ^! z( M& V" m. f/ |
  14. *3 O% i+ y5 j) e! j) [, s
  15. * This program is free software; you can redistribute it and/or
    0 F7 Z3 x: g2 ^! h* Y7 G
  16. * modify it under the terms of the GNU General Public License as
    . B! I: K5 r! s4 d( Y) ?. X! J
  17. * published by the Free Software Foundation version 2.
    4 i3 C! D" P4 T- @) }' N  K8 `4 @
  18. *: G. s# Y' j: X0 I, v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; O! R& p6 W/ _, t9 I
  20. * kind, whether express or implied; without even the implied warranty
    6 G; _% N8 M9 e% y9 O+ |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( w# D. B! C3 q; X7 b) Z! |
  22. * GNU General Public License for more details.: a! O  ^: r# |
  23. */+ z4 A7 `( j5 z$ V, M% H+ P& I

  24. 3 o% C- L# d/ t; H+ Y+ [' P
  25. #include <linux/module.h>
    % h; X1 Z: O: Z/ r% f2 s' a
  26. #include <linux/init.h>' C( h& O0 t* k+ r* A& @, M# L
  27. #include <linux/errno.h>
    $ Y, p! f; Y" x: ~, L
  28. #include <linux/types.h>
    $ h6 j6 H- p+ ]  S
  29. #include <linux/interrupt.h>+ X4 p$ ]  i" ^9 j$ O1 s  i$ M
  30. #include <asm/io.h>4 o: N& D: X& u; `0 I: I5 y
  31. #include <linux/moduleparam.h>" E$ \8 M) Y9 ?7 i
  32. #include <linux/sysctl.h>
    ; B/ M% N* P5 i/ J8 A8 C: N
  33. #include <linux/mm.h>
    5 P; A$ R& z% e5 K& p3 |! e
  34. #include <linux/dma-mapping.h>
    . p  Z% D5 p0 m0 Z
  35. 6 x; }0 A5 e* T0 @2 ~
  36. #include <mach/memory.h>' t" p3 S1 c7 K, B9 A+ G+ @; H0 [
  37. #include <mach/hardware.h>
    6 V. R, b5 B& K1 Y- W
  38. #include <mach/irqs.h>. ^; x- n- \3 H) t
  39. #include <asm/hardware/edma.h>& I, T' m) D8 l; u7 e
  40. ' `5 E0 n% h1 Q: H& _2 a8 X5 V1 ]
  41. #undef EDMA3_DEBUG* ?2 ^4 C: P! J0 e
  42. /*#define EDMA3_DEBUG*/& u. m! g' ~; s+ r' Z
  43. 9 z/ j7 j! r& Q/ o) A
  44. #ifdef EDMA3_DEBUG
    & V- u* ?- `1 t& \) g4 l. m! f8 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 d4 r) j& L* [/ @! R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! }& r' y$ f  a! ~+ @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , M% |. |; b6 R% t
  48. #else1 W' U, ?& \. v/ b+ M% _# X
  49. #define DMA_PRINTK( x... )
    4 {* {" T: Y6 s; i/ N( h
  50. #define DMA_FN_IN
    " V! v! h0 ~7 v+ N
  51. #define DMA_FN_OUT
    6 [4 s1 ^! N$ N2 X
  52. #endif& h: L) P; J* L; w$ V! l
  53. 3 j9 f% I! G, [2 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 R5 ?6 F- H9 Z7 E* F/ E" g6 A) M
  55. #define STATIC_SHIFT                37 Y% ^$ K4 ]3 ^% I' l
  56. #define TCINTEN_SHIFT               20& w- R; l' P" Q7 b( U
  57. #define ITCINTEN_SHIFT              21
    8 @0 p" D/ }' X$ Q: A
  58. #define TCCHEN_SHIFT                22
    - q4 ?4 b; ~$ N- Z( ?
  59. #define ITCCHEN_SHIFT               23
    ) B0 m7 [, w) A" R8 E
  60. , ~0 Y  r3 W! k8 y8 S
  61. static volatile int irqraised1 = 0;5 d  ?; y4 o7 @* {( _
  62. static volatile int irqraised2 = 0;- ^$ @( [* M, H7 h' B# u

  63. : H: y+ P  ]; P4 c: U1 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / t1 ~- U7 i4 K& c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 {! ?* H# ^# i- R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]0 k8 E2 g% J# G; E
  67. $ F. [) A% F% X3 T7 t) d, ^
  68. dma_addr_t dmaphyssrc1 = 0;! ^, H- y. N$ V4 d8 \
  69. dma_addr_t dmaphyssrc2 = 0;
    ) ~- d! P$ T# o
  70. dma_addr_t dmaphysdest1 = 0;
    " i* }$ d& V* o. v6 b' W
  71. dma_addr_t dmaphysdest2 = 0;
    & T. n% E5 U$ G

  72. ! m/ n$ ]; E" @8 G+ M
  73. char *dmabufsrc1 = NULL;( u- r$ J' C) P
  74. char *dmabufsrc2 = NULL;9 [5 C0 J5 L  V/ e
  75. char *dmabufdest1 = NULL;. K) s' x# s5 r6 H* l1 e
  76. char *dmabufdest2 = NULL;
    6 h7 g2 q7 G# T; S' f0 S  B

  77. & T6 X' y: y! o! R: f- B7 ^& r- X5 T; v
  78. static int acnt = 512;
    3 h5 M9 B& P+ a  K  F8 a( Y3 J
  79. static int bcnt = 8;
    " `# w) m* ^& L! T3 T
  80. static int ccnt = 8;; O; E+ @/ V9 G$ j7 _% O
  81. 2 V; n  t8 Y5 G2 s( I
  82. module_param(acnt, int, S_IRUGO);
    $ s+ Q6 ]0 R. `- ~- D; S' Y! J  x) \
  83. module_param(bcnt, int, S_IRUGO);
    $ f! X* j' W5 Y- \9 k: E4 h# [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! m6 u- z5 P/ b  y: S4 y$ b
7 I. |5 S1 d' y2 x) Q3 S% G: W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: d0 z. g! M' Z" D7 g4 A& D" Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. |7 a3 `& O* V( ?1 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& h0 L( U4 f9 Y
' w' r! _9 @' s0 Z

0 y: E# M# R; T2 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 17:53 , Processed in 0.041101 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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