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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 h/ l1 q* d+ n/ j0 T3 _
  1. [code]EDMA sample test application4 H7 j2 {0 {) d) l4 G- ?$ E) y
  2. /*
    : }* v4 F; e! r$ L- r
  3. * edma_test.c! _$ Z, |3 O6 r9 y* U% z+ j
  4. *
    & m# l/ [) {. ]5 N' y8 {/ K6 Z
  5. * brief  EDMA3 Test Application
    , T# J" N* I0 h( _
  6. *
      S0 y$ o$ q; Q: C
  7. *   This file contains EDMA3 Test code.; P) i3 J( D: C
  8. *
    ; J# ^9 D% `" C5 Z5 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + v# ~8 r$ r  b1 t5 F# o7 l5 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- z+ a) M- K: B0 |) Q* P; T: ~) ~
  11. *         TO CHANGE.2 Z2 `' O3 w. @  ?0 F
  12. *
    * H5 b$ m& H# m2 A8 I0 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) C& e, V9 I# v% c: ^
  14. *  u3 G9 Z; {' r7 \
  15. * This program is free software; you can redistribute it and/or: W( a& y* u- K0 H
  16. * modify it under the terms of the GNU General Public License as$ n7 x3 T( x* ^+ p
  17. * published by the Free Software Foundation version 2.& t% h7 j6 s! Z: [, Q7 u* @
  18. *
    2 B9 w/ l! k4 s4 N* o! s9 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: J# n( f2 o+ [2 ?
  20. * kind, whether express or implied; without even the implied warranty5 v2 G9 ~' c8 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. ?! O' }( O6 u4 h0 _
  22. * GNU General Public License for more details.; D: T. \- ^$ U& R4 W
  23. */* ~% E* E9 l5 E" u* C  y
  24. 5 w5 R3 Y5 ~  S& E+ t
  25. #include <linux/module.h>8 i0 E7 T8 a# J' I0 n  Z
  26. #include <linux/init.h>
    9 o  I: m. k0 E: P0 H
  27. #include <linux/errno.h>% q. A, t* G' G3 ?
  28. #include <linux/types.h>2 Y5 {- h6 E# v9 h4 u' x$ q0 Y
  29. #include <linux/interrupt.h>! ?/ T5 X, F0 ]  X
  30. #include <asm/io.h>
    0 y% C1 y9 ?4 c/ F0 i) {
  31. #include <linux/moduleparam.h>
    - e5 r7 ^5 {2 l
  32. #include <linux/sysctl.h>, M* J' V, ]8 B2 ^$ c1 `
  33. #include <linux/mm.h>
    : z' U  [5 N1 N& U6 n/ C; A! C+ q
  34. #include <linux/dma-mapping.h>
    , `5 K9 [$ F# H  C7 H  P

  35. 5 F* C/ f& k/ D1 |; H0 ^
  36. #include <mach/memory.h>6 ?) K% c% ^5 l; q5 V# W3 M
  37. #include <mach/hardware.h>
    , Z) }- z, R$ }& O2 L' j
  38. #include <mach/irqs.h>
    3 ~! H7 |" F) }& B* M
  39. #include <asm/hardware/edma.h># _, k5 B) a( p" B% W3 ?8 T! J" J: n
  40.   b' z  \: |! C; N+ Q# M7 F' T
  41. #undef EDMA3_DEBUG. b, M7 j" C& }
  42. /*#define EDMA3_DEBUG*/# F  ]( Q8 S9 H" m; ?
  43. 8 j# V% o8 |; L! i1 Z$ O
  44. #ifdef EDMA3_DEBUG2 V' ]' c2 x# ?, @; m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % V/ i0 F9 q0 W, D2 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ F$ A% r2 L$ [! g$ |+ {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 n; o2 _# H, |$ I2 f% F* n
  48. #else. I- C& E1 w- I& q; |+ u8 A% `; |7 i
  49. #define DMA_PRINTK( x... ), M+ R  b( |" u
  50. #define DMA_FN_IN
      o# y. O( K( j8 J& \% b! S
  51. #define DMA_FN_OUT4 `, Q2 c7 Z: [. m& _
  52. #endif
    - _& n. C' A8 r8 z( p3 o
  53. % U. V, i2 B* s9 d, ?1 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 W2 \" V5 a3 ^
  55. #define STATIC_SHIFT                31 K* w, `& D# Y% a1 b, T' f
  56. #define TCINTEN_SHIFT               20
    2 W, M  O: M; ?8 ^
  57. #define ITCINTEN_SHIFT              21+ K# u+ K  G/ w, B. {" F
  58. #define TCCHEN_SHIFT                22
    $ w' X+ ~4 ]9 ]- `
  59. #define ITCCHEN_SHIFT               23
    * W+ k$ q' o, r" S2 `

  60. ; @6 w: s6 u. f" `8 o
  61. static volatile int irqraised1 = 0;
    ; t7 n7 m* d- O
  62. static volatile int irqraised2 = 0;4 m# I( P' z& K* c  x

  63. 3 L: [& W( C2 Q: S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u. f: V! w- A, M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 u) J$ `! J% v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 J: a7 W' @) A# s2 p  F4 f: T
  67. , N9 E) |! Y4 R( w% V  U2 R. c
  68. dma_addr_t dmaphyssrc1 = 0;
    8 o1 v5 @+ ?# [& q, S5 |  w
  69. dma_addr_t dmaphyssrc2 = 0;! F% C& j7 F$ [! x: ^) ~9 ?/ @1 K* D
  70. dma_addr_t dmaphysdest1 = 0;$ f  a/ }2 d/ Q$ L! D
  71. dma_addr_t dmaphysdest2 = 0;7 a/ L. `& y7 d$ C# X
  72. 2 t) I2 u7 d% R$ B( Y6 i3 Z
  73. char *dmabufsrc1 = NULL;" m0 e: l# S. q
  74. char *dmabufsrc2 = NULL;1 ^7 u. u1 q/ D) U7 f
  75. char *dmabufdest1 = NULL;$ y& i" k3 y% A' K
  76. char *dmabufdest2 = NULL;+ U/ h/ o; `, Y- e, P

  77. 1 c1 D: y/ b6 s; b
  78. static int acnt = 512;
    ; G4 }8 ^* y: Q/ D( P  [
  79. static int bcnt = 8;; C. Y- d0 t& S* U* D; d) w! U% o3 c
  80. static int ccnt = 8;* _* o& l, y" ~# z) e
  81. 4 W2 j) z) V4 i+ b8 V
  82. module_param(acnt, int, S_IRUGO);! e# u" Q6 }. U9 M: V% O
  83. module_param(bcnt, int, S_IRUGO);
    7 Y( l: U  O/ @9 z1 x9 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 \- j! v: q! @' a$ \

) }* E& j; a; D- U2 ^5 ~- b2 S/ I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 [. r7 V& m8 Garm-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 m2 P: a. M% u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' Y: m+ D8 o6 l3 V: _/ `( e
$ V( n+ c# }, [! b7 q. @) q6 J; C7 W7 q) t! v) d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 17:59 , Processed in 0.038768 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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