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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 @$ A( ^5 N9 }2 y
  1. [code]EDMA sample test application
    8 X9 ~( u$ @. O5 j( x2 m
  2. /*
    7 {1 P8 d) V2 K4 A& `
  3. * edma_test.c
    8 M8 P8 V) r4 r1 H7 X8 L# E
  4. *
    1 _* h% h$ [  V3 [7 z% ^2 P
  5. * brief  EDMA3 Test Application
    1 H5 s" j. t4 L$ A, g
  6. ** m0 z# P8 ?* a# D2 m
  7. *   This file contains EDMA3 Test code.
    ' b  @. O, e3 ?6 ^
  8. */ u- G! C6 g3 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 d; L/ f* i" Z' @( X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 T' b; |* P0 }$ Z: a% i4 G
  11. *         TO CHANGE.6 T' {. i& ]& m8 q4 l
  12. *
    ; u  n/ u1 j6 C* ^4 [$ @3 }1 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & |, z0 e) G1 s- b% T3 ?. ^+ ?; G, c
  14. *  n0 q& ~, n3 J: F
  15. * This program is free software; you can redistribute it and/or8 l! V9 O. A; `2 H) ^, u" {
  16. * modify it under the terms of the GNU General Public License as  l* n: z" m6 T! h7 Q! ]; K
  17. * published by the Free Software Foundation version 2.6 y6 }+ h. L% `5 V* O6 F
  18. *
    : Z& @+ a5 _5 J3 d  G% y# w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 L7 v% R- }; r% {' N. a' h
  20. * kind, whether express or implied; without even the implied warranty7 n* f3 D$ r: X; Y; J; `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " ^) T# L4 g. T
  22. * GNU General Public License for more details.* X% `/ o" I3 u' H* Y- l/ S
  23. */
    % H: F- p  x) r2 w) Q0 t

  24. 1 @) }1 o$ k" Z: @, O  ~$ ?) }0 l# i
  25. #include <linux/module.h>
    - h( t9 o8 E0 b. j
  26. #include <linux/init.h>& H5 e' J5 `$ I4 Z; \
  27. #include <linux/errno.h>
    5 @: Z( _; o  ~! @5 i: l
  28. #include <linux/types.h>
      y7 {/ z7 J" T. X
  29. #include <linux/interrupt.h>2 ~+ k6 g( \# c1 y! T! `
  30. #include <asm/io.h>
    ' D0 f7 O. r: k: P. w5 T2 k
  31. #include <linux/moduleparam.h>
    * d" j& b+ b( ?- O. q2 ^
  32. #include <linux/sysctl.h>  c: S! g) ~* h2 q7 M8 [$ T3 z
  33. #include <linux/mm.h>. ], m9 v' k7 z) P/ S$ {
  34. #include <linux/dma-mapping.h>
    - `& z4 n: B: U1 X- C

  35. 3 |- z. @* c, r
  36. #include <mach/memory.h>
    ' U3 h3 x7 Y+ E! U+ O
  37. #include <mach/hardware.h>5 H! z2 `4 k2 x9 ^+ n
  38. #include <mach/irqs.h>7 E5 Z4 e0 b' J# }& F
  39. #include <asm/hardware/edma.h>% U% w5 }  s1 s# o2 Z
  40. + v: ?8 X3 u3 e! R
  41. #undef EDMA3_DEBUG7 L6 ], \4 ~" g5 m0 o+ ?
  42. /*#define EDMA3_DEBUG*/
    $ t$ B% G% g  M7 `; {
  43. 7 A- y% I2 s" b+ R# ]
  44. #ifdef EDMA3_DEBUG
    - F+ R6 ]% e0 n4 ]. ^) m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / I* S& M/ J4 T; R( j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " s; @* r. |  _: D$ M' M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ @9 j1 {. g, B/ |+ E0 z5 ^
  48. #else
    + ^  E: b- e4 ?/ R: S* S( t! s
  49. #define DMA_PRINTK( x... )
    ; y1 T1 w7 K7 d( U. I
  50. #define DMA_FN_IN
    6 y6 k% j( s4 D! Q# A. c" S
  51. #define DMA_FN_OUT) Z1 B7 v7 H, `3 W
  52. #endif1 ^1 v$ }* h( {6 T

  53. 6 ^0 u, ^2 t) E1 }: v1 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" `! V2 E' r3 q! B5 L% \
  55. #define STATIC_SHIFT                3
    8 [' W; P& C; O  A* Z6 @
  56. #define TCINTEN_SHIFT               206 O$ d% U3 R. v- O( h$ z- J
  57. #define ITCINTEN_SHIFT              214 Y4 x# A: m7 t! ~
  58. #define TCCHEN_SHIFT                22
    - V# W; P$ @2 Y9 X# v! G
  59. #define ITCCHEN_SHIFT               23
    6 h7 }  I% Y* ~# B: {

  60. 4 V! V( m  U3 E3 G! z; m! M: a
  61. static volatile int irqraised1 = 0;2 `0 y; O) Y" K9 W9 ~. Y0 g+ S1 w
  62. static volatile int irqraised2 = 0;) a7 o/ w" J/ E! a, q
  63. ) F  b- i) h3 J7 r6 v* P( a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / J8 g/ n8 x, B. J) o! k" \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * a, @- j% F! P$ q3 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 V  _5 }3 r' |7 A/ |8 t8 A* E  l
  67. $ a# D/ q. X! {: A( M* M1 v* m
  68. dma_addr_t dmaphyssrc1 = 0;" u' F, g3 d0 a" N' {0 j
  69. dma_addr_t dmaphyssrc2 = 0;
    ) k$ a6 b/ i4 n% v. O
  70. dma_addr_t dmaphysdest1 = 0;
      P# r2 d% X6 m1 Z# z# U- d
  71. dma_addr_t dmaphysdest2 = 0;2 J; N& P  c" g  T5 p' ?
  72. # i1 l. f8 @( q5 f' b8 m' j0 X
  73. char *dmabufsrc1 = NULL;
    4 L. H2 I% _8 C# |5 k
  74. char *dmabufsrc2 = NULL;
    9 C! Z. Q% F& h% P/ |! a% q
  75. char *dmabufdest1 = NULL;/ |" B# B* ]1 y, Y2 \& c
  76. char *dmabufdest2 = NULL;
    , k/ X# e; ]9 f8 o+ ?0 z

  77. + ^+ P# W# w: v  q
  78. static int acnt = 512;5 h+ L) r" n- k7 k  k: R1 x
  79. static int bcnt = 8;
    3 [1 c6 W" y5 J9 z6 P2 v/ x
  80. static int ccnt = 8;
    , B9 }5 o" W( |) }7 R5 ^2 F

  81. * \& z1 q( s) h/ A! W! Q& c
  82. module_param(acnt, int, S_IRUGO);" m6 E* x  z' m8 i/ R
  83. module_param(bcnt, int, S_IRUGO);' k4 U2 |6 k) v) t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 _- p' ?" f9 K8 K" E: L+ w9 }

. Z# c9 Q, @$ o) l5 Q- ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! P$ c' m. r! f3 L6 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) i( y( B/ H3 S3 ^; v: I8 ?! n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 [+ H" Z& F' p# Y& b0 m& u# p5 }2 w" G

) |* K* [" M) R) O, a3 G% Q+ F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 03:57 , Processed in 0.051809 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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