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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" r: p0 _; z" Q: k2 F( j  y
  1. [code]EDMA sample test application
    # i' ?0 o, U* ^5 Y0 a, D
  2. /*
    7 P' w# @( V- W) X# {
  3. * edma_test.c; S1 H* c! {$ H3 ~$ s: l
  4. *6 g; i  X, |) S9 T( K7 U) }
  5. * brief  EDMA3 Test Application  Y) m. |# X& X  T  c% a. ~# F" l
  6. *
    7 I3 x# h, I5 z& S3 B% L3 E' x4 t8 ]
  7. *   This file contains EDMA3 Test code.
    $ \9 d  a) |8 [4 g" J2 Z
  8. *) @% ?+ @! ]1 e7 r% h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 G, t0 i9 K4 _* P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : O3 x  t3 e2 f2 R" s
  11. *         TO CHANGE.( P& c: N0 E! p& _- l: U: T# j5 s* L
  12. *9 i  i+ I, m; A! {! u7 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# z5 J$ b# m* N
  14. *, }6 @5 V# ]8 h1 p. I
  15. * This program is free software; you can redistribute it and/or
    7 E# o6 [  ~2 \% a) {$ w
  16. * modify it under the terms of the GNU General Public License as
    # d6 c5 m0 l6 c, @2 j' x1 h& l
  17. * published by the Free Software Foundation version 2.
    2 F4 C( ?* b! a) I
  18. *
    / U; V0 k7 O/ i5 W* D  e: L) h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( V) H' p  n1 J1 M
  20. * kind, whether express or implied; without even the implied warranty' j- A- s0 M9 E' {# z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 V9 G( c5 `) [0 }
  22. * GNU General Public License for more details.8 G  c) A  c1 R
  23. */
    . E' F- t" m" y( i2 o8 X7 w
  24. 2 i- m7 C0 [  {# M# L
  25. #include <linux/module.h>8 L, J7 c, \  C8 U3 U+ }
  26. #include <linux/init.h>
    % T/ k6 [& D/ @  W
  27. #include <linux/errno.h>6 a2 S: k+ ^6 E( P+ \/ R- z' y
  28. #include <linux/types.h>
    6 V# ]6 @" r3 u4 g8 B0 n( ~
  29. #include <linux/interrupt.h>
    4 f- [6 M$ f4 F% y
  30. #include <asm/io.h>; d9 A- R7 m4 A% e3 z6 R" V" B8 O
  31. #include <linux/moduleparam.h># r* P. w2 T" k9 e% Y
  32. #include <linux/sysctl.h>
    2 n4 f. H8 i1 B* o9 M
  33. #include <linux/mm.h>/ Y* z; u/ B7 G  U
  34. #include <linux/dma-mapping.h>1 F- v5 ^2 l; E0 @7 S3 D  \
  35. ' k4 h7 y5 \. d! p' o$ Z  B! [7 D
  36. #include <mach/memory.h>
    , T1 F+ j/ z& H5 y3 V9 p( ?
  37. #include <mach/hardware.h>
    . e- g/ p3 k( b$ \; _4 ~" \, w8 S( F
  38. #include <mach/irqs.h>
    & K8 R" D* A' ^8 ]) t6 X$ Z
  39. #include <asm/hardware/edma.h>
    7 q& c& {0 ], T' x- R

  40. / ?2 z6 R$ o% \3 \
  41. #undef EDMA3_DEBUG
    1 y! O. o) L3 x$ y1 U' z4 `" J2 K9 Y9 ^
  42. /*#define EDMA3_DEBUG*/
    ( C( ?1 `" p0 C/ C6 c

  43. $ p' V9 V1 A4 M8 Z; R3 i! X
  44. #ifdef EDMA3_DEBUG( b$ |8 t+ ?7 t% X4 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% v* U1 u5 j: D2 [! _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # r, n: D5 _$ e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 b6 W6 ^$ S' l: V" h2 ?/ t4 |
  48. #else2 r& ~% A5 [8 Q& p; e! i
  49. #define DMA_PRINTK( x... )
    1 `# D- T$ N# D
  50. #define DMA_FN_IN
    - Q2 F0 }* S( O( z
  51. #define DMA_FN_OUT
    3 w/ s0 e9 Q4 O2 n8 Y2 i
  52. #endif3 z6 D8 }  }: f5 r- Y

  53. 6 r8 s) |0 [# W4 p5 B# }+ L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ X1 J- E) S# m: D- v* Q- b
  55. #define STATIC_SHIFT                3: P8 Q( E, ]. m) k4 x5 d
  56. #define TCINTEN_SHIFT               20
    4 l" m- I% d: e# ~5 }
  57. #define ITCINTEN_SHIFT              21
    & w+ e' w: m1 c, W
  58. #define TCCHEN_SHIFT                22; O# p1 j: U* c: Q" a* _3 Y% |
  59. #define ITCCHEN_SHIFT               23
    ( t% ~- ^  Y- k  Q8 O
  60. & Q# m6 P' ?2 R. @. s
  61. static volatile int irqraised1 = 0;1 ?8 j! P4 o9 s( Z/ j& A
  62. static volatile int irqraised2 = 0;
    7 M. h; N( a7 R& C; L# m

  63. ' {. ~6 K  c+ [' S9 x* q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ]: Z) @- q( ]$ ~5 g: q' g% j- B( Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h3 v. V, i! T+ |, r  t& d* Z' U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Y7 v8 l- N: E& \

  67.   K- a6 u3 e' Q  s6 i7 s  L
  68. dma_addr_t dmaphyssrc1 = 0;
    5 R# W3 S( D3 C8 o" e1 A
  69. dma_addr_t dmaphyssrc2 = 0;& O3 {% Y  B  G
  70. dma_addr_t dmaphysdest1 = 0;
    & q2 g: ^+ D, A. t7 p
  71. dma_addr_t dmaphysdest2 = 0;8 w& p" Q1 K3 X8 M& n" [

  72. / }! ~* e# H. z4 ]6 j
  73. char *dmabufsrc1 = NULL;9 x4 ~2 \! a5 n) T4 H$ F
  74. char *dmabufsrc2 = NULL;
    9 i3 g  h2 H! ]9 f* P8 F8 A; @! ~
  75. char *dmabufdest1 = NULL;
    8 u0 X. q! n9 x2 R3 q* C
  76. char *dmabufdest2 = NULL;
    / `7 t! x8 x# k5 t, ^0 S

  77. 0 W4 u7 b- X2 a3 r
  78. static int acnt = 512;( P# r5 _; V3 o" @9 ], B
  79. static int bcnt = 8;
    ! N, }6 Z5 c; _8 S0 r- A( R5 x
  80. static int ccnt = 8;# ^  c9 J  l. d! Y

  81. * g' |; X6 c" i& |9 Y# V/ B
  82. module_param(acnt, int, S_IRUGO);
    ) r5 m7 t) I" `) w8 ]; g0 R
  83. module_param(bcnt, int, S_IRUGO);9 C+ Z9 d9 A* o/ k1 y6 x3 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" b- l9 b* @; h" k- g' W8 m
; F) Y3 l) @& k# m* Z( r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ \& M7 @/ L! u- C- w% oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. f$ u! \9 A' T4 n' n& z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 ]. ?( @. p2 `4 t
. H5 s' I7 Q2 a, n$ h
' `; t" u0 L5 a; L7 o( E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 07:21 , Processed in 0.038002 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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