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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 L9 u7 G" u7 t) I) m: R) X+ H* I3 b
  1. [code]EDMA sample test application/ Q% e8 a$ }/ z, r
  2. /*
    * L4 A- |1 y4 `7 O8 T# o
  3. * edma_test.c1 t( |; R8 O/ C- Q9 c
  4. *& k; P9 a2 m* g  D6 a$ [8 W
  5. * brief  EDMA3 Test Application) L8 D6 ~4 A/ R+ y3 n
  6. *
    0 S+ R2 g" M. Q5 E1 ?" D% ]- y
  7. *   This file contains EDMA3 Test code.9 ^: ^, j! f& c4 c; u
  8. *
    " y. C7 x0 I/ d7 w8 G$ D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) v( K/ W; \! Y& Y3 x& n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 ]$ H9 F: x. k/ X+ _
  11. *         TO CHANGE.
    8 `7 V7 t) {5 C5 t  B( j+ ?
  12. *, @3 G# ^* G# y1 y6 p! e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" O3 g- @5 n, H! C- l0 r
  14. *
    $ s* V* s; T7 P
  15. * This program is free software; you can redistribute it and/or
    ( I* z$ H& L# G; P
  16. * modify it under the terms of the GNU General Public License as- W& R# \; q- u  g- T
  17. * published by the Free Software Foundation version 2.
    . r# A: Q/ g0 v$ x/ N* x6 r+ U
  18. *
    5 i, R0 f0 J& J* z* p' s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) K6 G8 Q: x% k- t4 X3 n* r* p' b
  20. * kind, whether express or implied; without even the implied warranty. P* d% K7 x' g7 y/ m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 S; i5 d$ j! R
  22. * GNU General Public License for more details., Q  o$ H/ Z2 @8 B6 @& ]
  23. */0 |$ \; E8 \" i. \9 ?- l

  24. 7 Q* c# V0 w  C/ c0 m9 ~
  25. #include <linux/module.h>
    % u, b" ~* `, ?7 l3 q
  26. #include <linux/init.h>5 ]9 y  M, w9 _% c! j% b
  27. #include <linux/errno.h>' Q, U  s1 @. D% ?% P. h& u! e2 {
  28. #include <linux/types.h>! t3 S7 H" F% ^' X9 ]# F' V/ m2 t7 n
  29. #include <linux/interrupt.h>
    9 r8 x, M# s: D7 n
  30. #include <asm/io.h>' f1 [5 \* ^9 I
  31. #include <linux/moduleparam.h>3 q* o! a) Q' \& u
  32. #include <linux/sysctl.h>0 U% \/ `  }) z* a$ N# B" z2 `
  33. #include <linux/mm.h>' n% X: e! ]' v7 x/ X) R8 k
  34. #include <linux/dma-mapping.h>1 I6 S5 C4 i! N$ u; u4 R, L

  35. * o! ^( K# U  o& j; S+ \
  36. #include <mach/memory.h>+ y: Z! o! J; H3 L7 H: t
  37. #include <mach/hardware.h>4 u. U+ G$ X+ V+ `' D
  38. #include <mach/irqs.h>/ N+ Y5 g* j9 c2 Z% P" ]% w. U( S* M* u
  39. #include <asm/hardware/edma.h>1 l1 H. L7 ]$ m

  40. - {/ v! V4 l( M! i
  41. #undef EDMA3_DEBUG
    5 J- ?) [& P1 b
  42. /*#define EDMA3_DEBUG*/
    6 I) X# D! p6 R. h

  43. / F7 k& a6 f9 n/ @# G
  44. #ifdef EDMA3_DEBUG
    $ c+ E6 R8 }/ ~- K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* I9 U+ Q# R' A' h! P9 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , M# g- }" z* n. e* _/ e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% |" C. _& m" `% l9 Z$ s
  48. #else) z" x( H, F: [$ m$ t
  49. #define DMA_PRINTK( x... )
    ; r+ |, s  h0 {- y* R3 P) N- l) l/ P
  50. #define DMA_FN_IN" b+ f  D9 u" n  V5 r( d5 |& }
  51. #define DMA_FN_OUT: m- Y( E0 B6 E# u& ]6 R! o0 n
  52. #endif
    3 c4 T. U. l. ~  N9 i, i! |3 @% e

  53. + s& O! Z) ^9 W, V$ H2 G; M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % v( q. H; S! a  v+ m9 L, V
  55. #define STATIC_SHIFT                3
    , s: W6 \0 R: a. x# P& q
  56. #define TCINTEN_SHIFT               20
    3 E( f- F' b/ g! ^" m" w
  57. #define ITCINTEN_SHIFT              21
    9 }" k* c1 J. \- b
  58. #define TCCHEN_SHIFT                22
    & g; W! H. i" \8 _. L: D2 P8 o: c
  59. #define ITCCHEN_SHIFT               23
    " [! c1 a0 H! n# Y6 O

  60. ' |4 S/ S; ]; b# ?, a/ `
  61. static volatile int irqraised1 = 0;' O+ l6 Y9 c3 N' ?% c
  62. static volatile int irqraised2 = 0;
    ! V% J- G6 I4 z) W

  63. 6 Q0 [( d: g' D6 o8 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + ^0 P1 P* c- ]* Q" w- w$ W6 z4 k# `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, q0 V. ^+ Y, s' O, g; d% r& h! A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & {* r: H& _# ]: B+ K. h

  67. + p" c- k# x& s. n
  68. dma_addr_t dmaphyssrc1 = 0;' Q1 R2 Z) a& F# V' C4 `( ?
  69. dma_addr_t dmaphyssrc2 = 0;2 m2 H7 v6 V4 h" y4 l  e: b8 L) ~
  70. dma_addr_t dmaphysdest1 = 0;2 r5 ~# l% a- C  n
  71. dma_addr_t dmaphysdest2 = 0;! B, B+ o) y+ S6 L1 n5 b$ o; `

  72. ' i' y6 y% a, p5 D! E/ e; |+ ]
  73. char *dmabufsrc1 = NULL;7 `* N1 A( ^+ j  B. d) a
  74. char *dmabufsrc2 = NULL;( R$ A( a8 R' @
  75. char *dmabufdest1 = NULL;
    9 n% j# K; `2 a  n
  76. char *dmabufdest2 = NULL;5 g, D( g7 y  U! v) `- D# G

  77. ! X- o+ E, F: y( K2 l* `3 J4 O
  78. static int acnt = 512;$ a6 T: z4 p9 [- a
  79. static int bcnt = 8;
    ) d8 m) u3 o; U. Q( |9 p3 o
  80. static int ccnt = 8;) S& n0 V' R# B  D, `7 f

  81. ' T0 Q- ?8 J7 l' c/ Z# V
  82. module_param(acnt, int, S_IRUGO);
    & u3 j7 e: m, b8 g/ P" P$ q, L
  83. module_param(bcnt, int, S_IRUGO);
    & d+ c' d9 J4 A3 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 j( W+ G5 I' [5 u/ b! t  n' K
% j: ~( F, C( V( u( I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 L2 [! G8 T2 J# qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 _6 ~, T1 T# Z: i; p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 n) m: K1 l. Q: R

8 ?  W2 z0 h1 K5 o% u: z5 ^: ]+ v/ d- J* S" Y* P& y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 10:21 , Processed in 0.037412 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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