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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 b% @" v2 e% x
  1. [code]EDMA sample test application
    3 z+ j7 k( T; ]6 A" G& ^1 N
  2. /*
    8 A) {- m- ]# D4 b( h2 r
  3. * edma_test.c% i5 w4 {7 |7 W% n) a, ?: A* v
  4. *4 d% Q# _( }% N6 T) ^9 j
  5. * brief  EDMA3 Test Application
    1 t8 g: J! i2 O# H9 m
  6. *
    ! e  K* \7 I; f* i# s9 g; B. M
  7. *   This file contains EDMA3 Test code.( v- |  ]* u$ P
  8. *
    : y$ x" e; C9 Q' E% I0 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' ^$ T/ R2 u# n, I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & H: g- J: B- I/ {' b
  11. *         TO CHANGE.$ g$ ?& v# `6 K+ g* L/ u
  12. *
    4 t' r% Q/ q, ~* I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, L, Z* }& ]' i
  14. *: {* S) N7 c( n6 `$ D( N5 A0 M
  15. * This program is free software; you can redistribute it and/or) s8 E4 s+ O3 e5 G1 t+ t3 R
  16. * modify it under the terms of the GNU General Public License as
    7 `4 a* o  ]5 i9 W5 c# C
  17. * published by the Free Software Foundation version 2.
    - B) ]' r# v3 N+ o
  18. *
    ( z" p3 \! V+ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % {- k3 x6 O8 X! [4 `
  20. * kind, whether express or implied; without even the implied warranty6 |0 p3 R! y* m7 }3 h) t. f0 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 I- ~: ?5 V1 U0 w( y: L# I
  22. * GNU General Public License for more details.
    1 Z1 W" T1 _' f) Y$ t. l
  23. */
    ! s8 B9 B/ }: j  t

  24. 1 \# t% l4 q$ f
  25. #include <linux/module.h>% x, ~+ Q$ T4 s' d3 T
  26. #include <linux/init.h>
    + Z+ m' D. G# {% Y
  27. #include <linux/errno.h>9 ^4 _1 x6 W: w6 f: X
  28. #include <linux/types.h>6 Q* A0 o- P5 ?: F1 c
  29. #include <linux/interrupt.h>( J$ {+ F6 p3 K$ p; I1 W/ \$ t( r1 ~
  30. #include <asm/io.h>; c5 L, x  K' M' t( i. [8 r
  31. #include <linux/moduleparam.h>; Z4 B/ @3 ^% H
  32. #include <linux/sysctl.h>! c0 @  _: g# w. @2 t
  33. #include <linux/mm.h>
    ! B( G' z& L0 G4 k3 K
  34. #include <linux/dma-mapping.h>4 ^1 [+ S0 d0 g" p5 @+ G

  35. ' n2 A8 y4 e: D" ~! N7 b
  36. #include <mach/memory.h>
    5 E: E0 ]* `+ F5 r
  37. #include <mach/hardware.h>$ B5 r& l/ {% k8 r- b0 V2 ?
  38. #include <mach/irqs.h>
    5 X7 N9 U& u# n) ?5 N, j! \. b; ?
  39. #include <asm/hardware/edma.h>
    0 E+ {) r* C% J, l

  40. + U% M2 A: Z6 y: b3 }3 @
  41. #undef EDMA3_DEBUG
    ; C  @$ ^( ~$ T9 R
  42. /*#define EDMA3_DEBUG*/
    # h# ?' F$ q7 Y" h, Z

  43. 9 ?/ l3 w+ O: L- q
  44. #ifdef EDMA3_DEBUG
    " W2 \' x* k8 e# Z0 B- N: D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): {* [; x* _" j% }! t: |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): |- \8 O5 c6 J2 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  {) x- K( Y+ O2 y2 Q2 F5 B/ Y# @
  48. #else
    7 i$ ^1 X6 B. V8 _. I
  49. #define DMA_PRINTK( x... )! V$ J9 m" Q9 A+ G+ s7 G
  50. #define DMA_FN_IN" T( F  `5 h* Z: s
  51. #define DMA_FN_OUT
    . [: J/ W. F+ N: {: m7 N
  52. #endif
    ) o) N7 @5 l1 w# L- d
  53. 3 X) L& v1 j0 x1 Y7 W" t+ Z% x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); P- U7 \% p5 L
  55. #define STATIC_SHIFT                37 U; l. V- z8 |) ]: s
  56. #define TCINTEN_SHIFT               20* Y( H9 m6 s7 j
  57. #define ITCINTEN_SHIFT              21- ~6 P# r' g! X/ r- h3 `" ?' m
  58. #define TCCHEN_SHIFT                22  W: R9 @  U; p& I7 V
  59. #define ITCCHEN_SHIFT               23
    ; {6 r! q' b( [; d; y/ z3 k; Z% ^/ ~( R

  60. : h, H1 n$ P& W" W8 e. {
  61. static volatile int irqraised1 = 0;
    . Q7 F2 \- j5 ]& o$ k" c& A
  62. static volatile int irqraised2 = 0;9 z& W, V  f, p
  63. 9 {+ a  x) S3 m8 k6 w1 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 g9 B  }6 w/ d* l( U2 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( w  A3 g. e- h$ Z! T( j" z, p: G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ~. ^5 S' L, }% l
  67. : k, a8 {; |7 R  w* Q
  68. dma_addr_t dmaphyssrc1 = 0;5 d8 C2 l' q- d% _/ I; E: |0 x! Q, h* P
  69. dma_addr_t dmaphyssrc2 = 0;
    : X" E. X/ s1 A& m! ?8 z' p( t( Q* W
  70. dma_addr_t dmaphysdest1 = 0;
    . s# ^/ ~) I/ {* B
  71. dma_addr_t dmaphysdest2 = 0;, x8 p5 x2 Y, N" t% h6 `1 G
  72. 1 o( t3 W- O3 }# t) W3 [
  73. char *dmabufsrc1 = NULL;2 @) Y. c3 o/ O8 x
  74. char *dmabufsrc2 = NULL;6 e/ D; d- |2 p
  75. char *dmabufdest1 = NULL;
    5 I0 {$ o* n$ P# r) b
  76. char *dmabufdest2 = NULL;* a$ X  B' S+ c8 ?; }5 O
  77. ; i+ U6 C% O( i& x0 Y% S4 d1 s
  78. static int acnt = 512;
    2 g8 C+ M% v8 B$ T  V* w
  79. static int bcnt = 8;+ a9 J8 W! N- m
  80. static int ccnt = 8;) ^8 \6 O& b/ a2 @  m; B5 a" t
  81. 0 j6 t" S  h4 h( H3 n. g3 Y
  82. module_param(acnt, int, S_IRUGO);+ g% p( O2 n$ ~7 F6 c  X9 ?# H
  83. module_param(bcnt, int, S_IRUGO);
    . ^# \: O5 K1 Z% r' X0 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' v4 o) k4 t+ z3 z8 f1 T! k6 Z
  J9 T+ {6 M/ G% n5 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- H. U, i8 p8 ?) [( p% p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' w; L% t2 N5 Y8 J1 T2 U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, Q3 x; K* M2 v
  b( x" H2 L4 v' }* w+ q

( w, h& t7 F0 c) ~. N9 u/ @8 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-23 21:37 , Processed in 0.047389 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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