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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- {6 C. w3 N: Q- a# e
  1. [code]EDMA sample test application
    ; V: Y) ~* w2 s
  2. /*: Q' W+ W+ }2 c) o* g3 k6 Y6 m9 a1 F
  3. * edma_test.c
    / i* a! x6 p6 u& B# ~$ M
  4. *) b  ^! p  J. q% F3 k' Q
  5. * brief  EDMA3 Test Application
    3 H; f+ i+ O# Z1 `
  6. *6 a: y: g  N6 @( I
  7. *   This file contains EDMA3 Test code.
    # p7 D5 F4 F2 V6 B
  8. *5 Q& c0 O9 t; @0 w6 c7 P, T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; S& W) q, b( K* h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 y4 d. Y; I, h/ b+ b" s" `- b+ Y
  11. *         TO CHANGE.! H  M( w% w- ~; s8 b
  12. *
    1 |* g" u" X% U! u5 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  Y: {  t1 f  ^2 O
  14. *# i( t( o. n) X% z! n" n$ |
  15. * This program is free software; you can redistribute it and/or
    4 v* y7 O' O. O8 C+ I4 N$ Q
  16. * modify it under the terms of the GNU General Public License as( h: F0 M- b  W1 i3 Q1 G
  17. * published by the Free Software Foundation version 2.8 |4 I# D* Y, Y$ p% R1 j
  18. *
    % z5 H% r: I1 Z3 [' y6 Q/ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- r6 E' b0 R' {$ C0 F9 x$ A+ Z
  20. * kind, whether express or implied; without even the implied warranty( |7 F7 ~4 ^' ^; k# n1 j! f4 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 c7 V4 V" ^' G; Z4 ?4 w3 E$ X
  22. * GNU General Public License for more details.- X3 c4 \  f/ {( C( o& L, @
  23. */( [! F( i) X% R8 x
  24.   r; \3 u0 G, @2 l
  25. #include <linux/module.h>
    % Z; z% E. C; K$ Y8 m8 t
  26. #include <linux/init.h>, J, Y. k: Z1 |: q
  27. #include <linux/errno.h>
    ! {) C( u, _: v; S. i- o8 R
  28. #include <linux/types.h>
    ; X2 c. _0 B" @  N+ I; x* V# Z
  29. #include <linux/interrupt.h>
    " k) D* c" L$ J. J; v5 O0 J3 B9 |' w, ]+ D
  30. #include <asm/io.h>
    ; s0 z/ w% V2 y6 }
  31. #include <linux/moduleparam.h>4 g0 k$ v" ^2 H; N; |
  32. #include <linux/sysctl.h>. i$ h( S7 n3 |4 Y; B; [5 }; ?  V
  33. #include <linux/mm.h>
    9 H3 O: z. E' ?! z
  34. #include <linux/dma-mapping.h>- o: I* i$ F% |8 K
  35. + Z1 j" H  P, {$ t4 {& c
  36. #include <mach/memory.h>
    ! K3 X# M. C2 d6 C% x) a
  37. #include <mach/hardware.h>
    ; H) g& \# o' \1 l- ]4 O
  38. #include <mach/irqs.h>& z3 `0 j7 ~- D! C& X
  39. #include <asm/hardware/edma.h>
    0 }! O8 M- V+ |) l  {6 M% A
  40. ' |5 Y) p* v& v
  41. #undef EDMA3_DEBUG
    . ~* g5 v( s4 w
  42. /*#define EDMA3_DEBUG*/
    2 S7 I, s2 d# v( w2 l3 |

  43. 8 L5 I9 t$ Z( E9 u: z& e% x/ t
  44. #ifdef EDMA3_DEBUG
    2 x/ n! `# A1 m) @5 Q/ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 W" A( F! T' H7 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! B8 e) N# ^8 d0 w' [! c; N5 V* D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , w" {/ ~- \7 v, ~. T+ y
  48. #else- @3 }) f0 L7 S0 @+ F+ I5 Z
  49. #define DMA_PRINTK( x... )) ~/ U( x1 t: R1 m2 d7 O
  50. #define DMA_FN_IN
    8 j/ q8 {) Z3 K5 o7 y2 J! v( ], [; `
  51. #define DMA_FN_OUT! J4 D+ I7 \+ W+ w
  52. #endif
    2 c* s8 L3 u4 ^
  53.   h, U* S7 K$ s5 U3 L# i( Y# _: ^5 b9 N6 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 U, F/ r, `2 U1 K: Q) T: a
  55. #define STATIC_SHIFT                3
    * M: E$ f/ c, P
  56. #define TCINTEN_SHIFT               20
    8 Q& V# E$ @, [4 g' j; _1 p
  57. #define ITCINTEN_SHIFT              21: R# D  f- ]5 _/ w
  58. #define TCCHEN_SHIFT                22' h8 C' U9 |" l$ ^7 Z
  59. #define ITCCHEN_SHIFT               232 b2 Y4 ~' C6 h( n% h1 `0 n
  60. 9 d7 e$ s$ F6 l
  61. static volatile int irqraised1 = 0;6 T3 R  Z  ~1 M$ ^
  62. static volatile int irqraised2 = 0;
    ' ^1 X$ h4 U0 _' E" i7 M
  63. $ u; b0 }4 @: V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M% R, f3 v" n1 @# w& b3 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 w3 _- U% ^, k) R8 C1 s4 {# Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m; c  O3 b* @, h) I3 Z

  67. ; E# a3 `; z2 W5 y( b. \; p6 j
  68. dma_addr_t dmaphyssrc1 = 0;
    ! x4 h& Q' L# K7 ~
  69. dma_addr_t dmaphyssrc2 = 0;
    . H4 Z2 [7 G1 f5 a7 O4 ]/ d7 K0 v
  70. dma_addr_t dmaphysdest1 = 0;9 l' x" Q' A6 r2 _, l
  71. dma_addr_t dmaphysdest2 = 0;6 A# n" Q, d& F/ R

  72. ( y8 G/ I+ G) [0 u" e* K  L9 M9 o
  73. char *dmabufsrc1 = NULL;
    5 K0 [7 t! k% `6 D5 L3 V
  74. char *dmabufsrc2 = NULL;
    ; q' T8 E' S. ~! s1 {8 Q( i6 R
  75. char *dmabufdest1 = NULL;
    + D/ X( h; A3 S0 r
  76. char *dmabufdest2 = NULL;
    ! _- `; f! s) u. K
  77. - P: b% F5 L( B6 a( G
  78. static int acnt = 512;/ }6 q' T4 ], J6 x2 ^  T& }
  79. static int bcnt = 8;
    $ ]3 o; z4 F) E; a; a8 r4 K$ i
  80. static int ccnt = 8;, ?/ N4 ?  e6 X8 f; t0 D

  81. - _: A8 @1 u& O' v. D; G, H( z
  82. module_param(acnt, int, S_IRUGO);; `4 {$ C" x; Q( v- I6 I  h
  83. module_param(bcnt, int, S_IRUGO);
    , k, `) R9 m2 M. B3 N7 q3 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& K. Z: k6 o  U4 d- o
) v- y8 p) q- t! f. C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 D8 m& ^8 q2 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# ^0 X# \! }: g$ m# s# `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: D) x. M& Q$ t0 k, {  [- u4 i1 W* u4 ?  ]. K1 t
, v7 U3 n  ?' R, T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 15:03 , Processed in 0.043035 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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