OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # G5 T* w9 `# Q4 i3 R/ x* K" |
  1. [code]EDMA sample test application
    * d) V7 |8 J6 ~0 C
  2. /*
    / ]* B4 m$ _( a  H
  3. * edma_test.c% y2 V2 H0 O4 c: N5 j! H  w, ]
  4. *0 N8 o( b  O/ K0 C# g7 t$ S% H
  5. * brief  EDMA3 Test Application
    " N$ u3 P% U7 I( O# U) ~+ ?
  6. *
    - `- N( c6 K4 i' e: {
  7. *   This file contains EDMA3 Test code.
    8 v! f8 I2 S/ I( I$ r
  8. *
    ; L. Y" ^  F# a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: T% [. |; {3 x, }2 s0 L7 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , G& B( z- z& L4 P" E  A& X2 d) l0 `
  11. *         TO CHANGE.- l. s; l& |% A: y% G& d
  12. *
    & l0 G: J" v, _( z' K! Y4 a+ c( e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, X& p7 k- V2 r2 b1 r. p% J) d
  14. *9 G+ D0 m( Y# P0 j7 W' N
  15. * This program is free software; you can redistribute it and/or
    0 N. ^" \, y* a
  16. * modify it under the terms of the GNU General Public License as- D; m1 K* q& M8 L) g% I( n3 ?: P
  17. * published by the Free Software Foundation version 2.: T9 i: I4 I8 ]/ X
  18. *. r& Q6 X) P$ G7 e* y* }7 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 _% J$ @; s" K$ p6 h  |
  20. * kind, whether express or implied; without even the implied warranty
    2 W$ r8 \) \3 @+ j- v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 h' U/ `7 n8 ^# b
  22. * GNU General Public License for more details.; [& w2 l7 b2 E; c
  23. */% r, t; }; |+ \0 I( N

  24. + B+ \1 }  @2 i& `- c7 Z
  25. #include <linux/module.h>8 ?5 J$ w- B* s. G
  26. #include <linux/init.h>& S7 q" p) b7 t
  27. #include <linux/errno.h>
    9 J' e" i. G. I- ^! H) C
  28. #include <linux/types.h>1 v% Y  b& t$ h7 M/ ]* a* U
  29. #include <linux/interrupt.h>
    $ j( N: X" f3 b
  30. #include <asm/io.h>1 w- ]5 F5 e. Q1 M2 I) O) c+ R" [* F2 ~
  31. #include <linux/moduleparam.h>
    - X2 M. a/ n, @8 _
  32. #include <linux/sysctl.h>
    3 ]! |4 z* G0 B8 z
  33. #include <linux/mm.h>
    . f# Z  U, y1 c1 A
  34. #include <linux/dma-mapping.h>
    " T) t  P" y/ @& f* ?8 X: Z

  35.   Q& K' R- q  q& h+ b
  36. #include <mach/memory.h>, \+ y5 Y% Q9 E
  37. #include <mach/hardware.h>
    * ~! P4 a- ~. O" t, Q
  38. #include <mach/irqs.h>
    ' P8 ^# U+ N* I1 }1 o* g
  39. #include <asm/hardware/edma.h>. q- q( c- {7 @# B( q. @

  40. ( D/ D$ g9 z- Y8 }0 ]0 q$ p5 T
  41. #undef EDMA3_DEBUG
    ( W( f! p6 ^, S% j+ B
  42. /*#define EDMA3_DEBUG*/
    $ _( q* r9 [; H5 f

  43. 3 u! h! e! L! U) F+ q% f8 p
  44. #ifdef EDMA3_DEBUG
    ! \, `! @" ?% m/ f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). O, k- E* z# I3 P9 x; a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ i* A5 F' Q& W) x9 F* q" \& R0 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% S, E/ ?. v# V4 Y0 d& \
  48. #else. U) Y9 F! V# K; H. m7 r$ d. i: I
  49. #define DMA_PRINTK( x... )
    8 P  M) d, J  A1 {
  50. #define DMA_FN_IN% w' x* T9 h6 O; s
  51. #define DMA_FN_OUT1 a7 d$ W" E: T+ I
  52. #endif  Q* j. b# e4 ~5 j
  53. * N/ R+ `: Y* L& r3 @' _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' |! f  d" C1 m( r
  55. #define STATIC_SHIFT                30 R5 P6 v# z& Q7 q
  56. #define TCINTEN_SHIFT               20
    $ D- b: M1 K( s& i1 x2 x
  57. #define ITCINTEN_SHIFT              216 f  W0 f/ c5 C
  58. #define TCCHEN_SHIFT                22, @. B* ]! H: z- B2 |
  59. #define ITCCHEN_SHIFT               23
    " v7 T# [2 z  j: @* E

  60. ; l1 V0 W1 Q, t& L, o& ]3 I
  61. static volatile int irqraised1 = 0;( _( l8 k6 r( B- l+ _8 V9 @: [0 h
  62. static volatile int irqraised2 = 0;
    ) T2 }& N. c( s/ B  f. T9 d! \
  63. ' {, L+ a7 H2 j" o2 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 j- U3 w( Z* ^9 p# @$ _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h# s6 P3 ]( b# C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \- y/ A# ?: w9 M4 I  [6 |

  67. # |5 P) S* `$ ~$ r
  68. dma_addr_t dmaphyssrc1 = 0;5 Y4 |8 y+ G: S( O* e- z- r% V1 r  R
  69. dma_addr_t dmaphyssrc2 = 0;
    % W/ n4 M! ?+ |0 }/ d
  70. dma_addr_t dmaphysdest1 = 0;( |) q. C9 S& F8 c4 e
  71. dma_addr_t dmaphysdest2 = 0;
    7 L- R, d# a3 H' P1 ]- F
  72. 3 L- m7 F$ z# ~- E
  73. char *dmabufsrc1 = NULL;/ O4 [8 q2 a. d4 L9 c, r/ r
  74. char *dmabufsrc2 = NULL;
    ' k( g$ [. Q& Q6 o3 y
  75. char *dmabufdest1 = NULL;
    3 u- C" {0 {! m9 i% L! Q, h
  76. char *dmabufdest2 = NULL;
    ! Q3 V7 n9 {1 K& s3 R. g- U. k0 I) ?
  77. / j' _! U! r2 R# w
  78. static int acnt = 512;
    7 i: p) t5 y. u3 @3 n# ?
  79. static int bcnt = 8;
    + `4 @  P& E1 R8 Z0 T8 h
  80. static int ccnt = 8;8 ?- S! S3 \/ L; _5 l1 L

  81. 9 O9 I; q5 B# q9 S6 l
  82. module_param(acnt, int, S_IRUGO);
    ! v* X$ I/ \0 l8 B
  83. module_param(bcnt, int, S_IRUGO);7 }$ G! q8 }/ I) z$ L/ |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 W" C5 Q/ j" g/ ~
$ ^0 B9 ?: P2 b  M7 ?% Q7 E6 R& R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( \8 @6 p' {+ v/ d' l' zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 q( ~2 F) F" n" X/ G) H; @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 }0 g$ `: y; P+ |2 {/ Z# T
, z) }8 V1 f3 V6 d% K
, N, b; K+ Z0 E8 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 07:24 , Processed in 0.039372 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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