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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% v0 h# k" X  U" T8 y; z( F
  1. [code]EDMA sample test application! A0 s8 X2 J4 v+ i
  2. /*
    $ G- ?. r! H: E; j! X
  3. * edma_test.c
    : ^( L7 Z, V4 S- F6 Y0 W' h
  4. *
    $ d) V  a! K5 G0 W& L2 i
  5. * brief  EDMA3 Test Application
    : U) u  B7 E6 W1 p; m- R. ~, _
  6. *. i( O: c% [2 c4 Q, I2 P
  7. *   This file contains EDMA3 Test code.
    ) N) U. u3 Z, {# p4 u4 ?
  8. *: [/ w1 D. k9 Q) I4 @* b0 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# r$ O( A% ~/ y. O8 g6 o& n) l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - V# v& N4 \& A
  11. *         TO CHANGE.
    1 {6 u8 s/ H' b8 X7 O  \; Q
  12. *
    0 S1 ^; g$ Z3 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% l( D# k1 {6 I, r0 k4 s, a: C
  14. *1 \! i. k' l3 X2 r* m* Y
  15. * This program is free software; you can redistribute it and/or
    ; t5 H$ L: K1 m# f) I% m
  16. * modify it under the terms of the GNU General Public License as
    6 d$ s1 O1 J: U/ u
  17. * published by the Free Software Foundation version 2.4 b# [! G  D% _
  18. *
    / z/ u' t. j: @. J+ Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # N1 b* A/ g& \
  20. * kind, whether express or implied; without even the implied warranty  ~! l. E. v3 T" D2 o, q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 u- W0 T1 p8 o3 J0 P+ I: u! E" r
  22. * GNU General Public License for more details./ N" I. B) X# z0 G# V! _
  23. */. r7 b" K) ]" v+ A4 W; e& a: ^

  24. 0 R0 g1 q! [' V+ p$ A9 I5 e
  25. #include <linux/module.h>
    8 Z: k% I2 @0 {9 r1 \# v) M
  26. #include <linux/init.h>
    7 ]# e: v' L% f/ ~: K! S6 B$ M6 B4 A
  27. #include <linux/errno.h>
    0 d0 X3 G; a$ X, {$ Y% b8 m( r) C
  28. #include <linux/types.h>7 F- q" y+ w# S7 M3 H
  29. #include <linux/interrupt.h>
    2 [: s, E" U) c% o1 u
  30. #include <asm/io.h>
    ; n. X" L- s5 D" V; C( r
  31. #include <linux/moduleparam.h>' r: x8 R9 f1 n+ _
  32. #include <linux/sysctl.h>3 v3 `, J3 V: ^! ~6 N3 M0 W
  33. #include <linux/mm.h>
    * P$ P2 {( |/ `% i3 V& Q
  34. #include <linux/dma-mapping.h>
    & ]- K. ?" P* T) u. t1 |* P
  35. # @, C4 Y0 l6 z& ]( ?; U
  36. #include <mach/memory.h>
    8 q- y' l4 L, Y' @
  37. #include <mach/hardware.h>7 e! S0 p, z+ ^; J
  38. #include <mach/irqs.h>
    % @/ x/ q- X' A" J4 T, e
  39. #include <asm/hardware/edma.h>
    4 i2 f4 k4 P7 m

  40. 6 j, m' `( [- N7 w4 v0 R
  41. #undef EDMA3_DEBUG
    1 [; ~6 D% B/ Y1 W2 N4 y3 B
  42. /*#define EDMA3_DEBUG*// k: n# e; X3 q, v6 L" e

  43. + m9 Y& d, s" D- C( E1 P
  44. #ifdef EDMA3_DEBUG5 T4 n  H( O. h  Y8 Y0 l& H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      L# k. F! g4 @5 |  z! s8 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 w6 h0 ^' W2 |8 H( y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  D. V: x# {7 h0 ~  b/ N, _
  48. #else! B* p1 Y0 e8 r! t2 |
  49. #define DMA_PRINTK( x... )
    . R  Z) e' j/ s4 S) k- t$ U
  50. #define DMA_FN_IN* i& Z1 I/ g9 [! S$ n) W! s
  51. #define DMA_FN_OUT
    ! k$ O  H# U( g* C2 g- f4 s
  52. #endif! [+ ]) l! _, f* n6 A
  53. 4 {2 X; e. O3 x. n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 n- t( g  e- f+ P; ?6 G8 k
  55. #define STATIC_SHIFT                3. C0 X5 ~/ K" F$ M
  56. #define TCINTEN_SHIFT               20! w  U- Q: C3 q" j5 @9 w7 U
  57. #define ITCINTEN_SHIFT              21
    1 \' [8 z" ~0 }; D& {8 O* w
  58. #define TCCHEN_SHIFT                22
    6 D7 T0 t. ~7 z' f5 f
  59. #define ITCCHEN_SHIFT               23
    . r, a9 N- P, F! u" Q. y8 m
  60.   L$ v0 b! V" O; W  r& A$ u% [
  61. static volatile int irqraised1 = 0;
    3 j8 F4 p6 `2 h' |$ K$ @8 F' j9 ^  H2 ^
  62. static volatile int irqraised2 = 0;
    / O, D8 O) c, b. v# G
  63. * x+ e$ x4 q9 S) g, h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 S) D* I% w: k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 ^6 r5 W7 ?8 x/ A+ J' A! [+ Y/ i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; I# I- [/ z  r, N  h% o
  67. * a' p  T# X% j7 m" |  t
  68. dma_addr_t dmaphyssrc1 = 0;7 T8 `( U" E8 H& I
  69. dma_addr_t dmaphyssrc2 = 0;* j! D0 j5 g: ?
  70. dma_addr_t dmaphysdest1 = 0;
    - Y! o/ G4 n$ z+ T' q
  71. dma_addr_t dmaphysdest2 = 0;
    : p# s- }  A1 P: U' ^" V, n" E, {
  72. 9 m; W2 C+ `, n6 ^$ ~, n: R1 D% V. }, I
  73. char *dmabufsrc1 = NULL;
    * {3 ^1 r% i. V
  74. char *dmabufsrc2 = NULL;
    % b5 ]: u0 T4 K! R# ^, g
  75. char *dmabufdest1 = NULL;/ u- m. T8 i3 z6 r" k
  76. char *dmabufdest2 = NULL;
      q5 ?: ]  O- t8 ~& u
  77. 5 G9 N) ^1 L8 x' K8 T. u3 N
  78. static int acnt = 512;
    7 S2 ?& w* H3 J, R0 ^% P
  79. static int bcnt = 8;: E* N) Y$ R# ~4 W5 H7 f
  80. static int ccnt = 8;# M% D' q" h+ x1 R5 N
  81. 6 m9 ?& o. t  W
  82. module_param(acnt, int, S_IRUGO);7 r1 ?5 R1 M7 @3 f
  83. module_param(bcnt, int, S_IRUGO);
    " c) `. m+ s% R2 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& @" Q8 K& }  ?+ l' \/ {3 s( E) B
5 `! F5 f: z2 J! Q2 k2 h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ o# u2 z* D( Y' m* {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 ^8 n" U8 j; W# L+ e3 u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ T- h. B) M# |+ M  E
" d# H1 i3 G( T0 R& d
# Q  B; n, y5 R1 n3 X- [! g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 00:35 , Processed in 0.037784 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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