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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 q9 G4 a5 r% A) Y# e- C
  1. [code]EDMA sample test application
    5 k+ b8 C; z2 c8 l
  2. /*
    ' G1 q0 o$ p6 @
  3. * edma_test.c" c" ^+ p8 p7 I! w
  4. *
    % f2 V, c9 d4 P( U
  5. * brief  EDMA3 Test Application2 ?9 l  j* a: f; k/ K8 W# U
  6. *
    8 _- F& ^4 X" E+ O% I
  7. *   This file contains EDMA3 Test code.
    ) n3 U7 B; U/ N" X
  8. *" u2 o+ r+ `' n; Y5 r8 s; K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 Z* t/ B3 Z8 a, e- l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , k5 F  C" ?3 A5 }' B, n, s* K
  11. *         TO CHANGE.$ }! k# T; h. _
  12. *
    7 M2 l7 a# Y1 K9 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 J1 W1 y, C5 Y  a, {
  14. *$ L' n8 h. S& a) [
  15. * This program is free software; you can redistribute it and/or
    ! X( t. c% C" K+ d& U6 j
  16. * modify it under the terms of the GNU General Public License as4 ?6 p" x2 d* Z( @+ X% f7 d2 z
  17. * published by the Free Software Foundation version 2.( W) q/ w7 O' i* Z; m3 a
  18. *1 p! O' N- `( l, a  l6 s# R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * s0 M* e) I& ^+ @( n6 N! l
  20. * kind, whether express or implied; without even the implied warranty: p: {% A. O) m  w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 L7 P0 r; W( r, S# e& P
  22. * GNU General Public License for more details.
    ! Y, C  {+ B4 m( J6 L5 J8 {) w9 L
  23. */
    1 `' V% `0 k7 i3 K- {* e, I9 \
  24. ! a: n0 ]1 H4 n" ^
  25. #include <linux/module.h>
    ! w; ~( Q5 a7 `+ a0 V/ `
  26. #include <linux/init.h>0 p! i  Z& Z; V; J9 x
  27. #include <linux/errno.h>8 r( S+ u1 ?$ S2 Q/ t" m
  28. #include <linux/types.h>: u4 h, x# i$ |$ L; L# N" V3 g  o
  29. #include <linux/interrupt.h>
    ) E1 U: B( p/ o+ Z9 e, D# p
  30. #include <asm/io.h>3 i* c! o$ u# ]3 q
  31. #include <linux/moduleparam.h>
    ' w( T4 P2 V% @+ |
  32. #include <linux/sysctl.h>
    8 \8 ^- _. ~# @: @, `
  33. #include <linux/mm.h>3 r% b. n0 z9 D7 o' c; _7 ]$ @
  34. #include <linux/dma-mapping.h>; M3 V3 J* O$ B: s* V: ^

  35. 7 Q( [4 g" {& p1 E. Z! m- }* }
  36. #include <mach/memory.h>5 y; v- }1 |- T: u
  37. #include <mach/hardware.h>5 H! C; Z2 c- @9 ~
  38. #include <mach/irqs.h>
    ! l) i( w+ m) Z9 |6 V* N  m
  39. #include <asm/hardware/edma.h>
    + [& t1 d# H7 j# Q1 t  G
  40. - n; ^" ]/ z# C. U' m% b/ u
  41. #undef EDMA3_DEBUG
    3 V( R& U0 K% k2 ?& c4 l
  42. /*#define EDMA3_DEBUG*/! s0 G' Q# x' E8 ?" j* W$ Y
  43. ) a- {5 X( t( J! R: j2 F5 J
  44. #ifdef EDMA3_DEBUG2 |6 `6 c% S( }  G+ ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 e: Q: Y, f! F! d. F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 y0 f* X& B. T  w4 X6 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * h* z, p, D4 K, a, D  X2 u# r
  48. #else
    6 T1 ^6 _* W' B' e+ ?6 M
  49. #define DMA_PRINTK( x... )+ k0 n  k: d8 g# `3 j1 E  [3 Q7 s
  50. #define DMA_FN_IN
    * v  m" l: W# @" v- ?* \/ O7 f
  51. #define DMA_FN_OUT
    - R$ Z* l) r6 j( [- i1 A
  52. #endif2 ]" z& N. J9 D9 }$ A: x
  53. 0 a0 B: u' S  P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 o. ]' {3 t5 m% U( S5 ^5 R) r8 d
  55. #define STATIC_SHIFT                3
    6 R+ f" ~( h( ]2 @
  56. #define TCINTEN_SHIFT               20
      s  K3 q! `, ?1 D  m% Y5 I
  57. #define ITCINTEN_SHIFT              21  Q; O) ], b$ B) E$ }, Z
  58. #define TCCHEN_SHIFT                22
    ( P/ L& I$ |* E; t7 J- ~4 D
  59. #define ITCCHEN_SHIFT               23
    . T) ?1 ?# L/ O1 M7 j; L
  60. 5 l! {8 Q1 h5 y7 C6 `% O
  61. static volatile int irqraised1 = 0;
    & U) Z' z" P# i% |' U6 n: I
  62. static volatile int irqraised2 = 0;
    : {0 [, z! E* @2 e: r5 }9 W0 I1 M6 H( x
  63. ) E5 O) {; k  N' H8 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ G- ]# X5 j% H( t; i9 h5 I+ k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 N& p1 ?. O3 m6 s  K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 F2 w5 e" t: s4 x
  67. * `0 N4 T, |1 {" W
  68. dma_addr_t dmaphyssrc1 = 0;
    $ P5 j: B: I1 G9 l; m
  69. dma_addr_t dmaphyssrc2 = 0;3 B/ i- M8 B7 A; X7 F
  70. dma_addr_t dmaphysdest1 = 0;
    ! A! I. _8 X7 c; J5 Z  p
  71. dma_addr_t dmaphysdest2 = 0;
    ( R, O( J/ M7 w

  72. - b$ t+ ?& g2 K& z& j' O8 L3 F
  73. char *dmabufsrc1 = NULL;
    & D7 r" a& p9 C: L
  74. char *dmabufsrc2 = NULL;" T- ~8 g- q5 \
  75. char *dmabufdest1 = NULL;
    & Z2 `& q& x3 `: s
  76. char *dmabufdest2 = NULL;
    0 H$ A! e9 u+ }- P5 k2 N

  77. 5 M* J' v. {& A' @/ S; \7 h6 L
  78. static int acnt = 512;9 Q2 p" T  u3 g' V. x, ?
  79. static int bcnt = 8;
    8 E9 L+ L8 U7 ]& |: C. I
  80. static int ccnt = 8;
    : l3 \( r7 X  T5 O7 S( b+ N: f

  81. 1 b3 S3 c' L- n) e2 |% a
  82. module_param(acnt, int, S_IRUGO);/ y* J# h% \/ A9 f. ]9 e8 W# X' [
  83. module_param(bcnt, int, S_IRUGO);
    & |4 f3 S0 w/ |7 {! ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 }+ M2 r; h6 P$ O( P* n+ [: \, k
) \# r9 n" T1 y! v, C1 S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ R( Z6 n7 |8 I1 `1 `! [) D. B) T$ q5 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' x3 z9 j* V3 |" Q8 w/ R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) M& h6 y3 i1 E3 R$ E; D9 G, i" x' k- n% w

) M$ ^  i! F* z4 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 05:19 , Processed in 0.039920 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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