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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 B* P& A- ?! c& L, O
  1. [code]EDMA sample test application
    $ e  B- ]/ M5 \. a& G3 v6 k
  2. /*4 u3 e$ p4 b/ Y" K+ ]- A2 _$ l
  3. * edma_test.c7 ^, c  T! u1 N; \
  4. *
    6 ]6 F( u: K0 b( f- D, I
  5. * brief  EDMA3 Test Application6 c  x' u/ Y" l- F
  6. *# B9 N' c% z+ ?5 `& ^# `
  7. *   This file contains EDMA3 Test code.
    ' @, S. t$ p9 I
  8. *
    . x* q1 `: {: y/ p; g, X) }( o9 L* I$ k% p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 b" L9 p/ G6 [. Q% S+ s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % d- y" c$ G1 E" t5 A3 ^# m, w1 Y
  11. *         TO CHANGE.
    6 |9 s* ?  |; o+ U' Q6 q
  12. *
    4 C$ |4 c( Z6 ~6 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. y( G5 Q  u4 k% g9 U1 m. [& M4 R" s
  14. ** z4 n* S: X7 g! a9 }
  15. * This program is free software; you can redistribute it and/or
    $ H/ c! I9 B2 Q' T. n: x- u% b2 J4 t* ?
  16. * modify it under the terms of the GNU General Public License as- e  o" Y. v- e; z& }2 }0 j% O
  17. * published by the Free Software Foundation version 2.
    7 S- t0 s8 @2 z! ?' W
  18. *
    2 D& R7 _/ @/ d( `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / ^, i/ A" w9 F- p) f: O6 L6 K
  20. * kind, whether express or implied; without even the implied warranty
    9 c% O) k! o/ e" B6 |& e1 b2 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & R- {4 p$ \) j% n: x1 T3 E2 K
  22. * GNU General Public License for more details.
    ; \5 q0 O: y  x6 A6 Y" N
  23. */, h9 g2 y1 T7 M/ Q* [

  24. % m2 |6 S/ z* q* H: g
  25. #include <linux/module.h>
    & v2 b( j' g+ c& b
  26. #include <linux/init.h>
    : N+ n: c; L/ j' q
  27. #include <linux/errno.h>* I% Y/ a- c  ^* ~: }8 c& R
  28. #include <linux/types.h>3 x. M4 t/ `7 z4 A
  29. #include <linux/interrupt.h>
    . i. _3 ~4 N$ i  z* H% o
  30. #include <asm/io.h>4 S; t& R9 v: m" _! u
  31. #include <linux/moduleparam.h>; I; W, a; C3 {
  32. #include <linux/sysctl.h>/ ]1 S! k" S5 u9 d
  33. #include <linux/mm.h>% w8 x& W0 `3 u$ T5 m7 F2 p
  34. #include <linux/dma-mapping.h>
    * F# G3 ?+ _) |8 f( I- k

  35. 8 i, D$ t- o5 Z9 [
  36. #include <mach/memory.h>4 {( l; M/ z7 X/ C7 Z$ A
  37. #include <mach/hardware.h>' R" p% W9 E& I, K4 A* W
  38. #include <mach/irqs.h>
      X7 E* N5 l8 M+ `( l  y" \
  39. #include <asm/hardware/edma.h>
    . N$ ?' @: z2 [! G2 C

  40. 0 m: x* ]" {4 E  `; S
  41. #undef EDMA3_DEBUG8 _+ M; G- c2 ^' E
  42. /*#define EDMA3_DEBUG*/
      O0 c; z# e4 K; f# I
  43. 8 [' _0 M& d( F+ S
  44. #ifdef EDMA3_DEBUG
    ! g8 g! w7 f" U% [  T7 N4 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " S( y+ _0 ~  E8 _- z; h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! v  t: G& k# e2 P1 y; a5 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- ]: R2 d) M* @; h8 z3 {6 k
  48. #else( r0 b% ~1 h) W7 \( Y$ a
  49. #define DMA_PRINTK( x... ): [- J4 `- n/ w9 K
  50. #define DMA_FN_IN
    ! _. K% i4 p6 L' K
  51. #define DMA_FN_OUT- k+ \! _2 ?5 j" F, F
  52. #endif( R5 l7 ?4 J% X/ p: q9 o, I, E
  53. % `- y3 k  W" X% y6 ^1 e& x! v- h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # J% K. K- j# C5 y% Q4 I
  55. #define STATIC_SHIFT                3
    . s0 ^9 u8 w9 }* \  {" i% ]" z
  56. #define TCINTEN_SHIFT               20
    ( ?' {, \, f5 T( o9 O3 B# k/ [- K
  57. #define ITCINTEN_SHIFT              21
    ! b4 L6 r: r1 n! J
  58. #define TCCHEN_SHIFT                22
      g" ~0 W" C7 t: J! J2 {4 w
  59. #define ITCCHEN_SHIFT               23
    0 H1 H; R  k+ H- o( _
  60. + w) a! ?' R0 ?, m/ U
  61. static volatile int irqraised1 = 0;
    2 u& m/ v) i4 y# A% W+ G% E$ S4 d
  62. static volatile int irqraised2 = 0;! a2 R+ o: B/ s4 U- d" y# e

  63. 2 i6 n; ?  l/ m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 t  _& T3 P$ ^! t6 G: M3 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 Q' f  R) r. c* s6 D2 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ~/ X6 K6 I1 i0 z

  67. 6 A) }4 o% u) H+ C9 ]- `  Y$ G7 K
  68. dma_addr_t dmaphyssrc1 = 0;
    ) l! X- Q: L3 i& i7 H+ R+ V
  69. dma_addr_t dmaphyssrc2 = 0;
    ( g; R6 c1 x9 u2 q/ w% X
  70. dma_addr_t dmaphysdest1 = 0;5 u. [0 M8 f  I! |
  71. dma_addr_t dmaphysdest2 = 0;: a9 y& p" ~0 u3 I9 {  F
  72. $ \5 \- g* k: b# I! i4 ]
  73. char *dmabufsrc1 = NULL;0 _9 c! V$ V. s1 Z" x9 ?
  74. char *dmabufsrc2 = NULL;
    , T+ T# K8 J& U' m7 ?" ?$ s
  75. char *dmabufdest1 = NULL;# M  q; f* H, {$ P9 v
  76. char *dmabufdest2 = NULL;  q: h4 W) ?3 K) |
  77. , ~# B8 d/ L! e8 l1 l
  78. static int acnt = 512;1 G+ G% D/ `! M. U7 [# R/ B$ n
  79. static int bcnt = 8;
    % m4 P9 n0 \4 g+ e
  80. static int ccnt = 8;5 f7 H# }: F0 u/ ]# g9 Z/ t

  81. & X2 x/ w! R4 o3 F! e+ F0 _/ M
  82. module_param(acnt, int, S_IRUGO);) m; @( Y. J2 S5 D* S
  83. module_param(bcnt, int, S_IRUGO);
    * }! Q" `5 C3 u( s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 ?" Z" {! P' j  F  t

) v: o0 B4 I" f/ y+ w* H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 D5 c( f9 s: n' R0 C( M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 C$ \) [; W8 a# K9 j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  K' j4 Z; I2 L( Q* _' Y1 l
1 K1 R, A0 c! |" m0 P$ O
- L" n+ L: K- X5 X9 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 01:26 , Processed in 0.047063 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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