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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" K' c! I  T/ I  ^
  1. [code]EDMA sample test application& a' m( p8 n: |9 N6 P
  2. /*
    + A* O2 d* p; Z$ h! R1 l1 l) G
  3. * edma_test.c: U* D/ A+ r3 G* F% e" y
  4. *
    9 M! Z) h& l* u" J3 g! ]4 M+ F& r" C
  5. * brief  EDMA3 Test Application
    9 `2 A6 m4 m/ p, Y
  6. *
    2 }$ A3 G# n! F3 V
  7. *   This file contains EDMA3 Test code.
    9 {2 k  k; I3 E( c& }3 t# T+ e
  8. *8 w' w0 P5 q0 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 A( F7 [. h* ?  C/ `  w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * F6 i: J1 C' w4 w9 G/ I
  11. *         TO CHANGE.0 a  j4 y! V* y/ B
  12. *
    0 j! ]# j0 k( f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / |; ]2 b2 P  S
  14. *( C4 v1 U1 o# h& z: |1 F6 v
  15. * This program is free software; you can redistribute it and/or
    ) \+ T; B  M% c% a
  16. * modify it under the terms of the GNU General Public License as5 u- v- x5 \& y' L0 e1 q
  17. * published by the Free Software Foundation version 2.
    . ]$ }+ r/ r' n1 S6 t4 {2 u, Y
  18. *, E2 s. |! s) O) E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! `0 g1 Y0 G$ J: `7 f) a
  20. * kind, whether express or implied; without even the implied warranty' m" `, Z, a8 D& `+ O  Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% D& Y3 G& }! o; i7 J
  22. * GNU General Public License for more details.* U7 E$ q" k( \
  23. */. m" n2 I/ J: e1 x4 F
  24. 4 C. {1 L. o6 v7 m1 n
  25. #include <linux/module.h>! `/ e6 g. c+ V  v! I
  26. #include <linux/init.h>
    9 c& P. ]) J4 w- I7 U* p# A3 M
  27. #include <linux/errno.h>) D# V7 \3 X' [5 \+ ~4 i
  28. #include <linux/types.h>
    0 h' _. b' [. a! c  O+ ]  u" z$ ~# p
  29. #include <linux/interrupt.h>* G# C$ H* ?* {, B) R
  30. #include <asm/io.h>: Y- l2 X* W. I+ b* }
  31. #include <linux/moduleparam.h>
    5 j9 t& _. I$ B
  32. #include <linux/sysctl.h>
    " x3 S! F" J& ^0 `
  33. #include <linux/mm.h>( I# P5 _+ b8 J- P* l0 Y& {* o: Z3 w* G
  34. #include <linux/dma-mapping.h>! C( {' D8 v, h) d& G3 V1 i7 f

  35. 7 F" Y% c: S% H& z2 u) e: H
  36. #include <mach/memory.h>
    ' \! k& R9 X! E4 S+ d6 R) c
  37. #include <mach/hardware.h>
    ; G$ B9 t$ N6 T9 W' l! c
  38. #include <mach/irqs.h>
    9 @, o3 X$ c0 ?
  39. #include <asm/hardware/edma.h>
    1 S% F- A& J. y. z
  40. ! n" `% K2 j3 p1 u, T# n3 e
  41. #undef EDMA3_DEBUG
    3 V% O/ U$ n0 B
  42. /*#define EDMA3_DEBUG*/
    $ }6 @& H1 `. f4 Z; h

  43. ; q5 Z0 g& `& D& P# q' e  K: {
  44. #ifdef EDMA3_DEBUG  i/ k! D, h& ?' X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 I# J- d# P) K9 X3 ?6 E# D& K5 {; Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 ~4 t1 U, x; r6 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 b% Q* g/ A# b: i+ g& r
  48. #else& s6 P3 r) w$ w
  49. #define DMA_PRINTK( x... )2 L0 r, ]* a2 o4 i
  50. #define DMA_FN_IN
    8 ?9 \- G. g. a2 O- o
  51. #define DMA_FN_OUT
    6 p- H" w# j0 Q
  52. #endif) Q# o2 z( P( I( I' F2 j+ W/ D9 A; y

  53. ) A9 e- O  X0 D, g5 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 W5 E$ w2 [; B
  55. #define STATIC_SHIFT                3+ w6 F2 U, ?" v% ?
  56. #define TCINTEN_SHIFT               20
    " m  g! e. i3 j+ S1 S- j" u
  57. #define ITCINTEN_SHIFT              21
    2 Y8 v8 r2 }  X' S' t  k: F
  58. #define TCCHEN_SHIFT                22
    8 A" E8 |0 s- @8 E0 Y# D/ p% j. k
  59. #define ITCCHEN_SHIFT               23
    8 r1 m6 Q0 X8 L! f
  60. * x' p4 `4 q$ ?2 I2 \0 A
  61. static volatile int irqraised1 = 0;6 h$ A1 H4 D% J' I+ x
  62. static volatile int irqraised2 = 0;  P- m  i7 J# `9 }+ [) Q1 O

  63. ) v7 B% W( u' P, R3 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ |& {4 F/ s* h4 o$ m% w- w( Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ^: b' W; U2 ~9 Q4 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) o+ C- v8 |' T/ Z
  67. 8 K' h0 z1 ?! z2 L
  68. dma_addr_t dmaphyssrc1 = 0;7 i) ?- T' {8 z. \
  69. dma_addr_t dmaphyssrc2 = 0;
    & e9 i* n7 G" Z" G
  70. dma_addr_t dmaphysdest1 = 0;( Y: X1 |2 H4 M
  71. dma_addr_t dmaphysdest2 = 0;
    7 u8 b) j* ]! k; x" a  a
  72. # t& k, a3 t2 A! t2 d: L/ q7 q% r
  73. char *dmabufsrc1 = NULL;0 g; t/ i& }. G' o3 M& b
  74. char *dmabufsrc2 = NULL;
    ( p# M5 Q7 n' @2 C! e
  75. char *dmabufdest1 = NULL;
    ( A& u3 X9 P" \4 C& I+ n1 e& p
  76. char *dmabufdest2 = NULL;
    ! Y& S+ r; G0 C& C

  77. 7 x1 c* n3 Q0 |
  78. static int acnt = 512;8 l+ Y. c3 d0 F# n6 w
  79. static int bcnt = 8;& V4 M" C& P6 _3 f7 F6 S
  80. static int ccnt = 8;
    % c3 N, ?0 M, h. l' [* l
  81. , q: s7 g; P3 q# s
  82. module_param(acnt, int, S_IRUGO);
    ) X3 r/ u3 ]9 J% f& ]0 o* w
  83. module_param(bcnt, int, S_IRUGO);
    8 X$ y1 @( ?% c: R% {( d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ J( m+ n1 L) ^( }5 g

) @4 c# D6 d) j0 r1 m2 z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# A5 u; v5 {2 j$ W; E$ a
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- O* U6 k& t8 u* d8 T% ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 l5 _8 x5 @  Y3 z0 n6 x7 k+ ?  N; p9 D3 E+ O
; D. X' v8 q; t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 16:01 , Processed in 0.039048 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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