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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 q; ^0 F1 z/ B/ P4 Y
  1. [code]EDMA sample test application1 m% e8 L( a+ f' H) i
  2. /*
    5 \: ]2 G2 ^, }- }
  3. * edma_test.c& N' }7 J& q! q. _- T
  4. *0 q/ c) o5 ^) r. I
  5. * brief  EDMA3 Test Application
    6 E9 x! b* O% e9 E
  6. *
    ; d5 N- c+ z" |0 j* [' @/ y5 _
  7. *   This file contains EDMA3 Test code.
    # }& m( v9 |/ m' G* U0 o1 _) P9 i9 l
  8. *
    , k- B, j+ l  i' O; R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; n* f5 c% A, K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . B5 k9 d7 c3 W7 ^) ~
  11. *         TO CHANGE.
    4 X4 @% @/ Z/ d6 p- d
  12. *
    # P7 B+ Z$ u7 i0 X) g" H/ N" j& r8 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      u% A- P" s5 u: E' _# M
  14. *
    - }! ^3 x, I# Q8 w+ l5 j8 T
  15. * This program is free software; you can redistribute it and/or
    0 ~! m- X* }: I" j
  16. * modify it under the terms of the GNU General Public License as
    - I0 b. k$ A6 @
  17. * published by the Free Software Foundation version 2.7 r7 t5 m! h" M' W7 @
  18. *
    + v8 C# E) b) H- \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* D# Y) q9 w5 `0 J' T+ L6 p
  20. * kind, whether express or implied; without even the implied warranty
    & u( k" F0 n% Z9 \( J6 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 c- |# S$ j/ v8 g5 ]2 b, g
  22. * GNU General Public License for more details.. w) H4 d+ x* K, y' o  r! p
  23. */
    3 j" F( _$ e- N2 e

  24. 1 \+ f' u/ ^: w" v; l
  25. #include <linux/module.h>
    ! H9 ]; [- |/ U
  26. #include <linux/init.h>9 j7 z3 M& C2 |
  27. #include <linux/errno.h>
    ; q. i* N. u' d, s% r% r; w/ V
  28. #include <linux/types.h>; t5 @! D# Z6 f/ S- e# q
  29. #include <linux/interrupt.h>1 b; d% p9 h# d! ]
  30. #include <asm/io.h>, c# @) }+ `) j5 x' _
  31. #include <linux/moduleparam.h>
    5 ?5 B" x: u/ ~( J
  32. #include <linux/sysctl.h>4 @: k* y2 D8 y
  33. #include <linux/mm.h>% E9 N4 W% G: u  I& Z
  34. #include <linux/dma-mapping.h>
    ' f0 D6 p# Y9 H/ B1 S  E* h, k
  35. 6 C. @: @7 H6 D4 L
  36. #include <mach/memory.h>
    7 ~7 u4 o6 J  v4 \# G" y. b
  37. #include <mach/hardware.h>
    " @, _0 Q7 T. b+ \1 f7 L: C
  38. #include <mach/irqs.h>
    ! |, c5 R) U' w" z0 m. K
  39. #include <asm/hardware/edma.h>2 P. z# F9 u0 Z9 G  ?1 o

  40. . ^& x, I0 v$ o$ j0 y% \: Z+ W
  41. #undef EDMA3_DEBUG4 e0 v! f$ [. ?( l! z
  42. /*#define EDMA3_DEBUG*/
    " ]- z7 Z, I3 b6 E7 U

  43. * J+ F! _8 Y9 e) s3 {4 {9 P
  44. #ifdef EDMA3_DEBUG
    6 H8 ]- c( b8 h' k' d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f: t9 H* a$ }5 }2 M7 A, O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . k* `) A( @; o6 f. w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; E. n) T- C/ U8 E" b3 Z
  48. #else* ~& d, r7 s, n- p% _; T* o
  49. #define DMA_PRINTK( x... )
    5 i# s) ?  u8 x- U
  50. #define DMA_FN_IN
    % J7 B3 \8 c8 A( ~! u; S, r
  51. #define DMA_FN_OUT6 b4 p& y! u% P6 B, J
  52. #endif) n5 c, e1 L% A3 Q) F+ ]4 x$ m
  53. + B% X' m9 P* y: g' p$ P9 H$ t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ J/ O  X; a. L) b, a
  55. #define STATIC_SHIFT                3
    2 }/ X& [2 u: n( Y0 K
  56. #define TCINTEN_SHIFT               20
    1 W2 A+ ^# g, P+ j8 _$ R7 j3 \
  57. #define ITCINTEN_SHIFT              21
    9 @2 q; q9 F( }
  58. #define TCCHEN_SHIFT                22" N" [, W0 ^! @6 ^
  59. #define ITCCHEN_SHIFT               23
    . U7 w% I3 t$ z6 ~! J3 o
  60. ( a7 p  o5 s5 ]7 T6 U5 l
  61. static volatile int irqraised1 = 0;9 m( z& c0 l) e9 h( h
  62. static volatile int irqraised2 = 0;
    3 L# I4 ^- r9 ]- X
  63. + o: g/ ^4 a/ i$ r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, d  k" g' a3 I8 e" L7 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s( l1 W( b* z, Y! @, @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ~9 [- v6 ?6 ], y7 f& F
  67. + @' b& ~% P* [4 w6 i( [" m" M+ Z* h
  68. dma_addr_t dmaphyssrc1 = 0;
    & X& P/ A9 D9 h2 O4 c
  69. dma_addr_t dmaphyssrc2 = 0;; |- J5 q* t* x' V, B6 j
  70. dma_addr_t dmaphysdest1 = 0;) }) N0 t4 G+ X6 S! T
  71. dma_addr_t dmaphysdest2 = 0;6 d0 r. f& l7 z

  72. ) H2 W: a5 t+ \+ M, N, u
  73. char *dmabufsrc1 = NULL;
    $ d6 k: ]% D7 i+ ]7 _/ r5 Z3 P
  74. char *dmabufsrc2 = NULL;. R2 R- l" J$ J5 A
  75. char *dmabufdest1 = NULL;! D  M5 n6 D7 S5 V9 y. l) N
  76. char *dmabufdest2 = NULL;
    " O! y; l' S' m8 ^

  77. ( y  V9 `& |3 t
  78. static int acnt = 512;: F9 i  _5 K( _3 V4 r/ B. B
  79. static int bcnt = 8;5 \* F- h. d' V! L* _  ?" ~
  80. static int ccnt = 8;
    # y# h4 U$ @- S
  81. 4 l' q/ b. h7 K. Z6 |8 T9 F
  82. module_param(acnt, int, S_IRUGO);+ H, S$ }5 p2 e. }( L
  83. module_param(bcnt, int, S_IRUGO);; r6 P. b8 M  V0 i4 K" ?/ ^% m. r/ f1 P  e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ V3 q7 m. P1 w' O7 |
7 c/ g; R! k1 f6 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, g- {2 ]* X" y- m! m2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ k' I3 h7 R6 A3 _- e$ o5 r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( B7 l. O  `( O( c( n
8 B+ J) q8 f  H8 M- o& W7 i0 |6 I* t4 N/ L, q( J6 w& z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-9 03:01 , Processed in 0.047712 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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