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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 M* e; W- w" Z
  1. [code]EDMA sample test application
    ) r: [% w; x; I9 g6 d
  2. /*( {* S  m" X5 |6 [
  3. * edma_test.c
    . M* v5 Y3 F& E# G9 k
  4. *5 @; G4 ^, V% N7 ]/ M+ |$ V3 T
  5. * brief  EDMA3 Test Application1 g$ Q% I$ F% |% [
  6. *7 z/ S% I" C5 R( o' r2 Q# U9 \; o2 s
  7. *   This file contains EDMA3 Test code.( p) _* w- V1 T  e# e  M9 ?
  8. *) o; w+ ?9 W9 P3 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 @4 D- X9 @; C. n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; n  b' {1 L' D1 k, l" z
  11. *         TO CHANGE.
    + }, U. {* g: G* _/ n
  12. *
    ! S& H- K6 u( B# ^5 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " O  A. o5 S" |+ c/ O0 v
  14. *
    : x9 ~# S. m6 Y0 c. H
  15. * This program is free software; you can redistribute it and/or
    ) d7 P0 a- `) ^& F' a9 Q
  16. * modify it under the terms of the GNU General Public License as
      H8 [. ?- x, y  v0 g( O
  17. * published by the Free Software Foundation version 2.$ P- P- h6 j, i) b1 Q  J
  18. *
    - @0 R* \. |/ R( X# I5 ^% {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # L( ~' A* F2 m! M* x# C
  20. * kind, whether express or implied; without even the implied warranty, p0 O: B3 }7 w% L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" k4 J/ F/ [. F! ]( j( |% o0 M
  22. * GNU General Public License for more details., [* ~0 Q& [7 q2 `+ x2 H
  23. */- X- G$ L6 [! [7 R% x
  24. " ^& b7 m4 @# A# w
  25. #include <linux/module.h>- I) h$ o, c/ R. r6 Z6 M
  26. #include <linux/init.h>4 _: V; F9 q2 N
  27. #include <linux/errno.h>7 w3 D' G) Q5 n! a
  28. #include <linux/types.h>
    ! y. I' z! N) ~4 A% l' J
  29. #include <linux/interrupt.h>
    " H2 W3 I' r. n: h
  30. #include <asm/io.h>
    & B( z) g  l: i0 p/ s6 A. L
  31. #include <linux/moduleparam.h>
    + K0 ~7 z7 X4 B, U. U
  32. #include <linux/sysctl.h>0 u4 ~: u( u3 L
  33. #include <linux/mm.h>
    ) h" `& w5 Q$ M8 P) j' C6 Q
  34. #include <linux/dma-mapping.h>' I7 z' Z2 [$ X, |6 l$ Y0 C

  35. # R# R, V' ?" M/ T" c! E7 V
  36. #include <mach/memory.h>
    : u# H/ D) p/ U+ G( q$ v
  37. #include <mach/hardware.h>
      @' M( w0 x: ?1 B
  38. #include <mach/irqs.h>2 U# B0 v4 N! O3 e" i
  39. #include <asm/hardware/edma.h>
    3 r3 {1 s. W: b
  40. * A- ]% V$ `( o; \' o2 l9 w
  41. #undef EDMA3_DEBUG
    5 K9 v( }0 X/ S8 ]3 r
  42. /*#define EDMA3_DEBUG*/
    2 N. ]6 W* Z" R' T: j5 v+ Y

  43. ) r7 ?" y$ }& O) P3 c: |
  44. #ifdef EDMA3_DEBUG# o5 P. D9 v6 u6 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); E# R) Y  A: i  B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 ]  o+ j. ^# i' M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 ~  l" C( u2 T
  48. #else7 K' x# @6 V6 h( n% N! c' d- d6 ]
  49. #define DMA_PRINTK( x... )
    ! \; q" T; i. A
  50. #define DMA_FN_IN$ ~* x" p9 n# |% E- ]9 M
  51. #define DMA_FN_OUT
    2 W" k+ C. q& K5 i* B6 P) N$ B
  52. #endif% c+ [9 A  M+ w5 |

  53. 2 @" `) y) Q' G( l+ ]3 m2 G" ?6 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 `* a$ q( P& L' S8 S, k* l
  55. #define STATIC_SHIFT                3
    2 }0 g  c/ z3 }; b, C; C; {7 i
  56. #define TCINTEN_SHIFT               20
    ( ]  n( |( y+ S. y2 c6 t3 O
  57. #define ITCINTEN_SHIFT              21
      `: g! b( q1 G* B3 c
  58. #define TCCHEN_SHIFT                229 a" o9 u+ V- S/ S
  59. #define ITCCHEN_SHIFT               23+ O$ a- X# W+ p8 p$ z" K' z' B

  60. # `, w. E, J* c/ B
  61. static volatile int irqraised1 = 0;1 l% c: I& t* U( J1 H, g: P
  62. static volatile int irqraised2 = 0;( ]* u1 j  i# l. k/ C1 D

  63. ! q$ w1 p7 P. s6 l7 k7 }( f" v& L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 l8 K- d' Y9 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , j& T( f; [1 N+ z* N5 }; z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ {- j9 M+ S2 {1 R8 M
  67. + [* }- a4 d5 ]9 n
  68. dma_addr_t dmaphyssrc1 = 0;
    0 r& i( \  m$ R% I/ y
  69. dma_addr_t dmaphyssrc2 = 0;) P0 L0 ]; p7 B8 s2 O0 h4 S( W
  70. dma_addr_t dmaphysdest1 = 0;' J( \" \  Q# F( N/ E
  71. dma_addr_t dmaphysdest2 = 0;
    # G/ g# i+ H- L

  72. , g1 E4 |8 I4 h/ M: d5 s4 Q/ `
  73. char *dmabufsrc1 = NULL;
    . b; Q/ R, P' o8 L
  74. char *dmabufsrc2 = NULL;
    9 W- C, x8 A1 ~/ X% O" E, @
  75. char *dmabufdest1 = NULL;3 S+ L% m2 w2 {
  76. char *dmabufdest2 = NULL;" r! m. E. x1 U: o" l

  77. 8 A0 l1 l0 D% J8 g
  78. static int acnt = 512;- y/ C6 x$ K! W9 r+ L( F9 o
  79. static int bcnt = 8;+ x: X, `/ A7 M  F9 @1 ^: P' c
  80. static int ccnt = 8;( \* F8 Z' V- j* u* r6 J

  81.   Z" @) K) O  z
  82. module_param(acnt, int, S_IRUGO);
    ! j* C/ t9 v! x9 ]" W1 R
  83. module_param(bcnt, int, S_IRUGO);) Z( i3 S* F7 x* w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, X$ ?# j# U% p9 X! l  A, B: \
9 f2 F, F, S3 p" {; T8 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 i( }6 n  o8 T% T( N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 _+ b5 ^$ }9 g; \+ g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ v. x5 h1 _, J9 D0 A3 D: j3 @# F

2 b' |4 o: ~  M0 f; `
' b0 F$ b3 \0 ^8 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 16:28 , Processed in 0.040061 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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