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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . l; P2 W+ Z8 x; J9 ^# g; _
  1. [code]EDMA sample test application
    0 s- z7 \5 ]" r% c
  2. /** d/ Q: W2 B+ E3 `) H2 ^" w; F
  3. * edma_test.c+ {! @) Y9 w' g
  4. *2 }9 W3 {0 L$ X4 I
  5. * brief  EDMA3 Test Application
    ; [9 k% j0 F3 y/ V7 d0 `- g* E' [. w
  6. *) ]( m* l1 z) j$ ~% O
  7. *   This file contains EDMA3 Test code.. X: o- L% \3 ^4 E' j0 i( h
  8. *$ o* ~4 y5 a  L& Y7 f& O! `' n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 ?+ |' [$ }1 p. k  l3 l4 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ V0 B3 t/ l$ d; M  k( W  ]& o
  11. *         TO CHANGE.
    ; U- ?$ Q9 p2 a' `
  12. *
    ( H5 x4 I( [* w- G% m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 G2 o  M( g, ~5 f
  14. *
    9 m* w. j5 a) I; _# j
  15. * This program is free software; you can redistribute it and/or$ b" K2 _+ K0 r, K4 M$ B! l
  16. * modify it under the terms of the GNU General Public License as
    ( k1 m9 ?2 P9 }" D
  17. * published by the Free Software Foundation version 2.
    ' h2 d; ^/ Y- H3 {9 ^
  18. */ d4 w! C& u( S6 k' t3 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # N- N, @  b4 e7 U) i) y0 P! W& K/ M, f- k& e
  20. * kind, whether express or implied; without even the implied warranty/ Z) L! z3 f( m+ H9 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - d( j/ ^! H& h
  22. * GNU General Public License for more details.% f) v3 c6 c& U; g3 w, @( o5 }
  23. */4 G2 L/ }8 U" b! \7 W: b; e
  24. 2 Q/ B* W* q$ O! }- _+ O  d
  25. #include <linux/module.h>
    ( [8 Q( L) W4 ^4 Z! N' a! H7 ~
  26. #include <linux/init.h>
    ; o9 n# a) B& A% ~- @6 o
  27. #include <linux/errno.h>3 Z! @2 n" g, m& a6 m5 Z! G! V* w
  28. #include <linux/types.h>! F  p+ _$ j" t1 Z5 d7 W; \
  29. #include <linux/interrupt.h>
    - J, p) Y6 V0 ~- b) }
  30. #include <asm/io.h>
    . Z% z, u( Z- f: K. `
  31. #include <linux/moduleparam.h>* i* @& [" S6 M1 h$ c8 m: a' p
  32. #include <linux/sysctl.h># Q% u5 l5 X) o* w' D2 O' E  }
  33. #include <linux/mm.h>4 y7 x0 c$ P# ]' q+ y5 f+ K
  34. #include <linux/dma-mapping.h>
    5 h' J( ?$ _* Q- I
  35. 7 V- P, @% f. u( e' X
  36. #include <mach/memory.h>
    : X" [1 s! N5 B% x- ?
  37. #include <mach/hardware.h>* C0 @3 W- v& T( `; ~
  38. #include <mach/irqs.h>
    ( K0 m: i9 k3 v# n6 @# i
  39. #include <asm/hardware/edma.h>. o1 X4 M2 L1 O

  40. 8 r6 y: x, h% D
  41. #undef EDMA3_DEBUG. V* H4 \* T/ q6 `  y
  42. /*#define EDMA3_DEBUG*/
    1 r# |6 E! T! J- S$ d- P  A
  43. 8 d+ O' \6 d- G% H
  44. #ifdef EDMA3_DEBUG- D7 s2 u7 ~# L$ S1 F7 W* x5 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 x' }$ A3 V# U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! t! |# |, w( x/ {/ H4 p- E9 p6 ~, C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * t7 _5 c: s0 o4 H+ v
  48. #else  }1 ?( G* \& I" ^) V
  49. #define DMA_PRINTK( x... )+ |' g- Y. v3 n! e
  50. #define DMA_FN_IN
    " K# }2 R) x. b0 l8 V: t( P; k
  51. #define DMA_FN_OUT9 u$ T2 z5 G% T. Z5 P+ o# z
  52. #endif% J0 W& p: y, Z" Z

  53. / p5 Q- F' l# p; j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - w3 @% K* g4 q. Z% `/ g' `0 f
  55. #define STATIC_SHIFT                3
    / ~. y6 m3 n5 ~# Z) z5 A( y. P8 d
  56. #define TCINTEN_SHIFT               20% Q( q# c  A2 U( y8 O
  57. #define ITCINTEN_SHIFT              21
    5 U+ o% f- M) J7 V, a
  58. #define TCCHEN_SHIFT                22
    0 ]) O- k$ }6 Y8 ~1 N' Z4 f" |
  59. #define ITCCHEN_SHIFT               23
    ' f. x6 O8 }# L5 n, k3 F
  60. " G' V, e; M& \7 v! r1 B
  61. static volatile int irqraised1 = 0;! L) o/ z- \: f1 |$ D7 q3 i
  62. static volatile int irqraised2 = 0;( G% {. `% S6 ?" j6 Q. [* u2 E! C5 q
  63. 9 k0 c6 y4 }+ \: `  A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      _3 W9 R) ~: P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, T& J( X: I" r' w! i- g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 ~3 r1 G& T! L! O) o) Y' a. q
  67. , f0 Y2 `( x3 D" \
  68. dma_addr_t dmaphyssrc1 = 0;& p, Z4 {1 G* L/ Y2 ?/ j" E& t" u
  69. dma_addr_t dmaphyssrc2 = 0;* q9 h+ ?, o0 U6 L; Q6 W. G1 v- {
  70. dma_addr_t dmaphysdest1 = 0;
    ) Y0 l; g) ^$ q
  71. dma_addr_t dmaphysdest2 = 0;' b$ c, h! O5 |
  72. * g  W/ A/ `2 Y8 Z) o. L+ w
  73. char *dmabufsrc1 = NULL;
    5 a! l$ t; _: R& j; q
  74. char *dmabufsrc2 = NULL;
    / o7 f( J9 P2 G( t8 D( z
  75. char *dmabufdest1 = NULL;- K0 x) l) I0 ~9 c
  76. char *dmabufdest2 = NULL;8 w+ S9 |& R! {
  77. 1 r* h$ Q* G% k9 ]2 [! x; S
  78. static int acnt = 512;9 Z7 Z" s0 R" f# a
  79. static int bcnt = 8;5 K$ S/ h5 y" d6 T2 S) |+ g& G/ S
  80. static int ccnt = 8;2 Y3 b4 P* b! r: K1 A, [

  81. 3 p' G6 G. G2 U4 u
  82. module_param(acnt, int, S_IRUGO);
    9 p5 z4 m. {% U9 n; x1 s! o! K
  83. module_param(bcnt, int, S_IRUGO);1 Y- M4 J9 Y$ f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% v: j" F# b3 }6 I0 K! C! I  o. R* j. b* T0 B* X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: g+ @8 T& W; i, R! [' ^9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- e$ Y" m+ e2 j4 v' {' A1 z1 i/ q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# y* Q' e. n1 E- @- W6 R0 O

$ y+ w  a( s% D7 T+ f
0 D( Y- h. o3 k8 ]6 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 04:52 , Processed in 0.039437 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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