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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : E: o8 z) @' \& u
  1. [code]EDMA sample test application
    6 c. l0 h, r; v
  2. /*
    1 J+ O2 D' I- _& q4 K
  3. * edma_test.c
    * j( @5 f) u8 \
  4. *
      @, Y; f' o7 \( N. Z
  5. * brief  EDMA3 Test Application
    $ o" s" Q  A+ T7 E8 o$ O
  6. *% Q( u# \: ^5 |" x5 d
  7. *   This file contains EDMA3 Test code.) D/ w6 }5 R* h0 _% i- V
  8. *, d3 l) @4 r& c  }" Y* U% R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( D7 Y$ _/ }& V& Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 y$ I0 @" T0 R: G  P
  11. *         TO CHANGE.
    2 H- V" i. N9 M% m9 ?( E8 i. X
  12. *
    ! c' B. G. k6 y5 u8 \8 M2 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// I- l+ l2 ?: Y4 ]( K! P, L# J! I
  14. *
    , e' U' k; t1 @( D# S4 V2 M: ]) d
  15. * This program is free software; you can redistribute it and/or
    + u! F  `9 a! A! A* W! i
  16. * modify it under the terms of the GNU General Public License as4 T% C& H+ q! R* V) C# E
  17. * published by the Free Software Foundation version 2.
    0 x0 E& O. R9 }- ~6 j
  18. *  e/ r4 e' [, x" N6 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- T, a- ~) f% @% c5 l* I# S! K
  20. * kind, whether express or implied; without even the implied warranty
    7 j# F: V. W* g2 P5 H: p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! q& B6 [" R7 Y+ u% |
  22. * GNU General Public License for more details.
    6 ^2 V& p- V, N* g( i
  23. */1 l' ^. d. a/ K8 k
  24. * q8 \6 {+ `  S6 l4 j  _. v
  25. #include <linux/module.h>- j: s0 S+ X, B$ L% f3 j
  26. #include <linux/init.h>
    / E/ B1 {# L( L; z; F2 a6 i
  27. #include <linux/errno.h>8 |0 n# R% H$ H- t/ D+ T. l
  28. #include <linux/types.h>
    " u9 J  f0 s, N
  29. #include <linux/interrupt.h>
    0 w9 M) Q% U; \0 }5 E
  30. #include <asm/io.h>
    - z/ m# `: M1 y- s6 b8 C8 h5 h3 p
  31. #include <linux/moduleparam.h>9 O4 w, k0 H$ U4 b' b1 m
  32. #include <linux/sysctl.h>' K  a  @- M* i. |1 N( K  T
  33. #include <linux/mm.h>
    4 g% W, ~  g3 h. R3 A
  34. #include <linux/dma-mapping.h>5 d$ L( b' Y0 C" P# u6 e3 H

  35. - \& I, u' {8 o; F6 R3 X
  36. #include <mach/memory.h>
    . n$ k" _. ?% ~
  37. #include <mach/hardware.h>7 z+ i; G4 h' X
  38. #include <mach/irqs.h>5 L5 s: A2 H6 @' j/ a" c
  39. #include <asm/hardware/edma.h>
    5 h. ]2 t; n3 g6 E1 M# D0 V
  40. 3 q( F  }9 l2 c5 t1 @1 c
  41. #undef EDMA3_DEBUG
    # C' m* R9 G  }# R# K3 G
  42. /*#define EDMA3_DEBUG*/
    , }9 V, G. c- Q  O- h  }; G% k

  43. . u  p0 V4 t" I" \% P) U6 _
  44. #ifdef EDMA3_DEBUG5 z' T2 A) {4 `0 ~3 F/ A8 V) j, m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , P2 H; S! g+ N# P( R$ X, r. E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): C6 L( R) g, y2 f) f2 v& N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): |: a1 d3 Q, v7 w3 y
  48. #else
    ! e2 v( j/ j' {7 e+ N
  49. #define DMA_PRINTK( x... )7 z- u4 f, H' X
  50. #define DMA_FN_IN
    1 m7 Q8 Y5 _* N, V  M
  51. #define DMA_FN_OUT
    5 ?# d2 a( A: P- E0 L! `5 q1 N! h
  52. #endif
    8 i# O* a: U5 n* i% T1 I2 e% p
  53. * z. u% ~% t# l+ W+ m1 r: h4 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 t6 Z. q9 t" S$ @0 H
  55. #define STATIC_SHIFT                30 ?' A/ }6 o2 ?7 F5 [
  56. #define TCINTEN_SHIFT               20
    " x! J1 z2 U/ B( y
  57. #define ITCINTEN_SHIFT              21
    ; R* z/ `0 K6 \" m" F( ~
  58. #define TCCHEN_SHIFT                224 f- C! s, n9 \8 s$ Q# S) Z9 H
  59. #define ITCCHEN_SHIFT               23) A; B( w4 h, Q6 A' H; Z, j
  60. 7 M5 m6 K' z' M, X. {
  61. static volatile int irqraised1 = 0;" Y+ d# M% n& Q9 l4 E
  62. static volatile int irqraised2 = 0;
    % W& J, P  A) G9 G

  63. - C% X2 m  @: d8 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) W& t9 s2 Z7 ]; L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + n# K: [3 R9 E2 Z3 v. y* N  A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 V& |& R2 N# M$ ~2 i9 A
  67. 7 K% \! ~: w! F( h
  68. dma_addr_t dmaphyssrc1 = 0;2 i1 e1 V1 O$ S0 l& q7 O
  69. dma_addr_t dmaphyssrc2 = 0;- q. m% I8 p$ F4 @5 U/ {1 V# U7 e
  70. dma_addr_t dmaphysdest1 = 0;% x3 P/ S; M' T8 v% S3 V3 \% u. [
  71. dma_addr_t dmaphysdest2 = 0;
    6 D1 q( ]2 A# N0 e- `" Q$ D7 K
  72.   x, p' Q+ J0 j6 [9 L
  73. char *dmabufsrc1 = NULL;* {" P# t4 s) Q# O. Y  b1 X
  74. char *dmabufsrc2 = NULL;
    $ @, j# x0 ]/ J! N3 e1 h) w
  75. char *dmabufdest1 = NULL;; I9 M$ C, U  w- H# R
  76. char *dmabufdest2 = NULL;
    & a8 f2 @: K1 x" r- }* Q
  77. " t. s! }8 }! E: Q1 j( n
  78. static int acnt = 512;
    & U% ^- I$ K; D, S( W# \& _
  79. static int bcnt = 8;
    5 @  e5 U4 B6 y/ L1 ^4 `, Y
  80. static int ccnt = 8;
    ; Z1 ?' ~) ~+ w, b
  81. ) `% ?+ `5 d5 i# ]- W+ B8 \
  82. module_param(acnt, int, S_IRUGO);
    " t' r, [0 M) p6 l
  83. module_param(bcnt, int, S_IRUGO);( O, J3 `5 f8 f" ]3 L" F8 G, L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; Z5 |& Y( O6 J# F

$ F. y4 d& n- G7 V: n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; j2 W0 ~; j9 I; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) C4 c" Y2 H3 Z8 n: g8 n  h; K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# i- g% z4 x7 R7 N+ X  g
, r3 M; C3 d$ C, S( X* z/ J  }

' F( I) j0 n1 k3 s8 K9 E9 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 03:09 , Processed in 0.040530 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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