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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , o  H* k8 k+ f5 Y
  1. [code]EDMA sample test application
    / x0 Z3 d! [8 z1 C0 N, z5 I
  2. /*
    ' |: P& s+ P; V% c6 c5 c
  3. * edma_test.c
    # X/ i, W* N! H9 l
  4. *! z. H, L9 V: y$ y0 n* I
  5. * brief  EDMA3 Test Application, Q% S$ u0 `! z" Z: W, d
  6. *
    . a7 J) I3 Y3 X* u( ?2 D/ u+ {9 W
  7. *   This file contains EDMA3 Test code.
    % f& ^) a+ O/ r! ], Z5 D
  8. *
    ( I. Q( F2 E- U& g. {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& q. h# v& J! ]& S! p' T/ H3 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & K: n% {  S) `' u7 d
  11. *         TO CHANGE.
    ! A* Q2 L. H; ^' p7 R( Q$ a0 N
  12. *
    1 d* y' z" N  s" m+ ^- N2 C9 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 y% s+ E$ d1 C2 G1 Q
  14. *
    & B  H9 K4 g- b$ G
  15. * This program is free software; you can redistribute it and/or
    9 @9 z4 s8 Q/ a7 S; a
  16. * modify it under the terms of the GNU General Public License as
    9 {2 q& s  ?$ ?; o
  17. * published by the Free Software Foundation version 2.
    6 Y6 _" W& o& W+ \7 v5 B
  18. *6 X6 T9 Y  d* `% ]+ b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% T4 N& T4 v+ y" R+ U/ W
  20. * kind, whether express or implied; without even the implied warranty
    8 M; B0 c3 X) F! T  e: e" e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * f6 L1 [. W& B8 c) R8 K  V
  22. * GNU General Public License for more details.: ~. Z. ?1 R4 ~9 S9 t
  23. */
    0 U/ {3 G$ V$ y8 ]) t/ S
  24. . O" D5 G, N6 Y5 P: m8 g/ p
  25. #include <linux/module.h>
    7 t' e2 x: C& Q7 V
  26. #include <linux/init.h>" P* e' S0 r! g& S5 ^( g0 e
  27. #include <linux/errno.h>
    $ ]* d0 `; e" t$ C% }5 \& t' s
  28. #include <linux/types.h>
    % ^9 t9 x1 X/ w/ h2 ]
  29. #include <linux/interrupt.h>4 Y* L3 D! _1 ?4 S( D0 X  B
  30. #include <asm/io.h>( g+ x0 L6 A. M; m
  31. #include <linux/moduleparam.h># h9 f) Q3 D" R2 j
  32. #include <linux/sysctl.h>
    * d2 G- a8 \; v3 R3 f  @$ r9 |
  33. #include <linux/mm.h>
    ) j# C1 ^/ R% {+ A% \4 ^* C  \7 ]) K5 v
  34. #include <linux/dma-mapping.h>$ Y: [! D% p7 Q7 K( ?5 B0 I4 N9 u

  35. ! g, g- \: _3 K! g6 K1 _' K0 q
  36. #include <mach/memory.h>6 i0 s9 L0 |7 N) V/ p
  37. #include <mach/hardware.h>/ @3 `; m' q( l6 g1 n
  38. #include <mach/irqs.h>
    8 p# o+ q1 J" {
  39. #include <asm/hardware/edma.h>* ~0 X" t- ]& j: `" S
  40. ) d* P9 j# N3 T9 e4 i. W: b
  41. #undef EDMA3_DEBUG
    $ H) c) ]+ Q; I" U0 O9 e
  42. /*#define EDMA3_DEBUG*/
    2 ?$ T. I! L( B; h+ n+ j

  43.   M, ^/ `* H2 a7 {) E6 e- B5 G
  44. #ifdef EDMA3_DEBUG
    ! `6 a: f9 C! {! o5 S$ P  j2 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); t" j; G! U* M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 u0 l2 j- c. L* a7 B& v4 q) s' k; K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & E/ ?( s! q' v$ O; X7 r/ Z
  48. #else
    # \' ]3 v8 r& n: h0 O2 n2 `
  49. #define DMA_PRINTK( x... )6 ?) W$ H7 r* n2 l  r, u9 M
  50. #define DMA_FN_IN
    & Z- B  ^0 t3 I
  51. #define DMA_FN_OUT  K. ?6 t' G; B; E% X& p
  52. #endif
    ( W+ |( L  m" F) n& B/ n1 Q$ o

  53. . w! z' w- k1 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ T' W  V' x7 ?+ V9 F5 r
  55. #define STATIC_SHIFT                39 n# P8 G" K. c
  56. #define TCINTEN_SHIFT               20
    ! ?, C3 G8 r  Y9 S
  57. #define ITCINTEN_SHIFT              21" l% I9 {4 }) ?* w0 v
  58. #define TCCHEN_SHIFT                22
    ; m* w7 Q9 U# r' l
  59. #define ITCCHEN_SHIFT               23
    * @% v  L. g  o! V4 ~& r9 c" m$ V

  60. 9 S7 Y2 W$ L5 G( c% S
  61. static volatile int irqraised1 = 0;* |+ h" U  _8 q
  62. static volatile int irqraised2 = 0;
    : |& ]) d7 _4 S
  63. 8 a+ d5 E- m. |, a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ _9 B6 P4 \/ f% ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 W% {" `/ O/ j  |2 n! v# \9 s5 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 k4 u9 |# E7 j  Z' O

  67. . ~* _* S/ i0 O* y9 K
  68. dma_addr_t dmaphyssrc1 = 0;
    % L% W' ^' g* m6 C
  69. dma_addr_t dmaphyssrc2 = 0;3 a9 m, j+ F& v; P- {
  70. dma_addr_t dmaphysdest1 = 0;
    3 b" |  m+ D$ e' o& D
  71. dma_addr_t dmaphysdest2 = 0;
    # d) S! y# v- X; b
  72. % r5 h, K/ j5 u% M5 {  b
  73. char *dmabufsrc1 = NULL;  E! `2 @. R& ^  j0 I$ d! s; L3 x
  74. char *dmabufsrc2 = NULL;
    . s( V9 U  j. t3 ?+ E4 u! T9 i5 F
  75. char *dmabufdest1 = NULL;3 C) O/ `0 e( ?" K8 c; b' Z
  76. char *dmabufdest2 = NULL;
    / Q) S0 B# N' I- B

  77. 3 k; ?8 z. [4 }2 g( a" C; G5 p
  78. static int acnt = 512;5 [7 h8 P% m2 [8 y( |4 S7 i
  79. static int bcnt = 8;" F9 C$ T. _4 d
  80. static int ccnt = 8;
    ( w+ Z, S. X( z

  81. $ O. p% c# F( `: }
  82. module_param(acnt, int, S_IRUGO);, l2 l: A, e5 Z/ Y
  83. module_param(bcnt, int, S_IRUGO);
    ! e6 M5 ?2 Z* N" M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( t- {0 x# E2 O

' \. h. w) b  ~7 b2 @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 B# {+ R- n3 \: S: F* i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 U: r- L$ ^+ C' q2 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 r3 w& P. ]0 P! V% J; c/ b" t
* `3 ?# g& w% P$ C
' l. a" X+ O" O% ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-2 22:40 , Processed in 0.042484 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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