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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- b2 p8 u2 p$ p6 _3 V
  1. [code]EDMA sample test application
    1 C. K- g+ a& Z$ F, r# u8 O$ q
  2. /*
      c+ S% ]4 b, j% p
  3. * edma_test.c* p4 ^/ l! I, t6 z/ _
  4. *2 N0 `- U+ J# y& D/ V0 N4 ?1 ?
  5. * brief  EDMA3 Test Application
    ! g; ]* Y/ M6 h) p6 @! A: V
  6. *
    " x$ U7 w# h0 F" m
  7. *   This file contains EDMA3 Test code.
    " ^& j8 B# V2 V5 d- U+ k1 N
  8. *
    2 L1 R: F0 H0 ~7 i0 H& w5 {# m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ A, b* L" \% Y/ C# ?$ X3 E0 t: f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ u& b% \( D( Q' v" P7 C' D' a
  11. *         TO CHANGE.! A0 c1 Y4 z: z$ N; T, {3 p  p
  12. *9 j7 g8 M5 V. k7 P2 b5 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - x7 v' S0 p$ G- F
  14. *
    6 D: C" ]5 f1 G3 [
  15. * This program is free software; you can redistribute it and/or+ @2 ?0 m, G- U; l' z1 m/ z
  16. * modify it under the terms of the GNU General Public License as
    ( I+ s  D6 z* K7 s* }4 T/ i
  17. * published by the Free Software Foundation version 2.
    " |& c2 M* d+ A1 j6 H  ^
  18. *
    7 M% E4 }: U0 i7 u( f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: r% X3 ~% j+ ~3 f
  20. * kind, whether express or implied; without even the implied warranty
    ' z; L+ d+ e9 K% z' [# S1 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* a, x0 p- U9 d) S3 i
  22. * GNU General Public License for more details.+ W# u* W$ }6 k6 [6 _
  23. */
    8 F) p9 D2 r2 O, C. S

  24. 4 h# r; R1 a+ _3 Z- e' O! M
  25. #include <linux/module.h>
    ; D( }* j2 I, m; X; t* X
  26. #include <linux/init.h># n( Q0 }$ J- N+ f. k! D2 k+ S
  27. #include <linux/errno.h>
    ) U6 {" Y2 q( _1 m5 L- P
  28. #include <linux/types.h>7 U* h7 {6 g% @  ^; K( h
  29. #include <linux/interrupt.h>
    , l  U0 t) Q" G5 R1 E9 t% @
  30. #include <asm/io.h>
    8 U: T) l! d  \# s
  31. #include <linux/moduleparam.h>
    * j& O$ q; j* k, N/ p- q
  32. #include <linux/sysctl.h>
    . }8 f  J! G0 Z! T  I0 {8 c
  33. #include <linux/mm.h>
    ( }( u, ]1 B/ o
  34. #include <linux/dma-mapping.h>! B/ x' Z" b* V$ T

  35. ; h- c+ q: V  v, C1 ]) p
  36. #include <mach/memory.h>
    # {+ p" \7 l8 F" x7 r) A
  37. #include <mach/hardware.h>$ M5 X' Z1 b5 e
  38. #include <mach/irqs.h>$ S. I& t+ W5 t2 }
  39. #include <asm/hardware/edma.h>+ y% x$ ?, a, Z; e

  40. - K9 A# u7 J2 v9 D+ T# k' K5 ~
  41. #undef EDMA3_DEBUG
    $ q5 G8 n4 g. T  A0 f3 I1 h
  42. /*#define EDMA3_DEBUG*/. o$ f6 T6 p+ t
  43. - G0 R- d0 t) d( s0 d3 x# B
  44. #ifdef EDMA3_DEBUG
    9 P  k8 _: q0 Y6 O  S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ T8 l* r* q( `8 \1 ^$ |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 q& V4 Q7 n! ^7 d# w5 b5 T" x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" H% d0 x" i, t# ]8 s% f
  48. #else
    . n( W; N: v+ i
  49. #define DMA_PRINTK( x... )6 r3 r) k) a1 N# ~/ ~! u
  50. #define DMA_FN_IN
    / _9 E6 O  W( v4 K! `7 ]- w+ ^
  51. #define DMA_FN_OUT  [7 K9 s0 K& L; J9 i' f
  52. #endif7 w* D1 ~9 B1 q1 m! U
  53. - N9 U% V* z5 ^% o9 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , y( }1 y# V1 {' j% r
  55. #define STATIC_SHIFT                33 l) H+ `. ]: s5 d1 k
  56. #define TCINTEN_SHIFT               20  t/ E7 H; q# A  i, g  P' {
  57. #define ITCINTEN_SHIFT              21
    : [  `* P: S  j
  58. #define TCCHEN_SHIFT                22" Y6 l! o# M- B/ K
  59. #define ITCCHEN_SHIFT               23/ F, Q# B$ @# H2 `, ?

  60. 4 L/ a: J/ w! Q2 U" `
  61. static volatile int irqraised1 = 0;
      J3 K- D; m' @+ A& s
  62. static volatile int irqraised2 = 0;2 b1 \/ {' f8 P1 G* g4 q

  63. : _7 V  f/ w/ q( T9 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 c  i6 c. M" F. Z! f  k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& U4 K8 M9 Y4 `- y7 a2 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" g9 n% k4 o2 B8 l8 m2 ~; p1 c; ?
  67. 7 K1 |3 g8 b! T8 i* ^6 m
  68. dma_addr_t dmaphyssrc1 = 0;) [$ R3 `1 K! N. ?3 a7 j+ q5 L
  69. dma_addr_t dmaphyssrc2 = 0;1 E3 o; k( K3 k' k' I# c8 A
  70. dma_addr_t dmaphysdest1 = 0;
    3 {: w. T1 D; E2 }7 U( ?2 A
  71. dma_addr_t dmaphysdest2 = 0;
    8 |) H/ r4 Q0 T

  72. 8 Q- q0 v; f- G+ g/ K
  73. char *dmabufsrc1 = NULL;& _3 g% U8 M6 t6 E
  74. char *dmabufsrc2 = NULL;& P2 `, u! a, |2 o3 Z; I
  75. char *dmabufdest1 = NULL;
    7 R8 x( X" k/ v$ ]5 E' p& v/ G
  76. char *dmabufdest2 = NULL;
    & ]6 l2 L( k% b6 N1 w# W

  77. 0 @' g  g& @1 \8 x' B  q. ?  P
  78. static int acnt = 512;, v; y7 |( U! _+ Y7 I
  79. static int bcnt = 8;
    $ }! h6 S8 _6 p. S/ ~! Q
  80. static int ccnt = 8;
    1 C7 k+ L1 |6 Z

  81. : a$ f. Z2 G& F: H
  82. module_param(acnt, int, S_IRUGO);
    2 h0 R! `5 `8 N
  83. module_param(bcnt, int, S_IRUGO);: Q0 A0 A+ N1 ?5 e2 |' V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; u1 l) b% ]8 x# ~
* D0 {4 D2 j/ p% C% h6 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% A0 J% I% a4 q& }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 L8 R0 u, E  E. I+ j; G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 K3 O6 |/ o5 Y$ c
; }9 ~6 a% w$ v  a
2 w& n- m8 |! M; r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 09:53 , Processed in 0.035852 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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