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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 @7 d9 T1 h5 ^8 T& t+ d; ]- B7 w
  1. [code]EDMA sample test application: u. p  ^* h! r9 Q; V# ]+ C& O
  2. /*- Y, r- G7 F" L1 P
  3. * edma_test.c
    3 |7 y6 {# I6 m# Y8 K
  4. *
    / i/ J' W. d4 ]$ O5 O
  5. * brief  EDMA3 Test Application; j6 V2 m. K8 g7 h3 g. C) q
  6. *
    4 A: q; c$ A5 K! v7 H% y% |9 c
  7. *   This file contains EDMA3 Test code.
    ; H$ Y+ h4 ^8 d% y# [& \
  8. *
    . K# u) J) }# u7 a: f# t0 ]4 i3 i& I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) |4 e: }5 z- s6 t; K, G" @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) [1 G4 @* o7 \3 h3 M$ I
  11. *         TO CHANGE.! S7 i2 l, u3 j0 Y3 p' {+ P9 a
  12. *
    / ]! }" T' l$ J2 b- _7 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) Y' u( m4 J3 U
  14. *! a$ K3 p* m# u2 q, H
  15. * This program is free software; you can redistribute it and/or
    3 `5 x) ~6 }8 ^3 }! n! G
  16. * modify it under the terms of the GNU General Public License as
    8 U9 D4 f) `# p! R- J
  17. * published by the Free Software Foundation version 2.5 z& ~1 P  H: s- m+ e- T# T4 J
  18. *
    * d! N& c, d9 _/ D3 D  N) V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! m3 `$ m' A% T$ F$ Y& ]8 g( B: S
  20. * kind, whether express or implied; without even the implied warranty: A4 P1 c8 Q+ b$ y: o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 [0 [! S/ z) X$ ?' ~( X1 k5 o& K
  22. * GNU General Public License for more details.4 w  Y% X/ H' _( `3 t
  23. */
    8 D0 Q2 I; ~- j( M; B9 O/ t
  24. 2 A' r( R  P+ O0 U1 e: \
  25. #include <linux/module.h>
    - p0 ~0 }3 z+ b% V  h& ^
  26. #include <linux/init.h>
    + F8 Q. v6 ?% u& l. E# {
  27. #include <linux/errno.h>
    . T- @: E5 A, H9 s
  28. #include <linux/types.h>
    + X) \- }  b/ ~& I
  29. #include <linux/interrupt.h>
    ; H8 j6 _- V3 N  H' \- O# r* a
  30. #include <asm/io.h>/ E- D0 u+ h3 {6 ~3 w7 _1 r# w
  31. #include <linux/moduleparam.h>
    ) |2 s, M' y8 |' ?* Y
  32. #include <linux/sysctl.h>3 }. P* O$ q) V2 u/ V9 f2 k, `, t
  33. #include <linux/mm.h>2 w+ u- w2 A+ j7 u8 v# T6 |  {
  34. #include <linux/dma-mapping.h>7 `+ Y# `5 ]9 Q- q8 s7 U' u

  35. ! B% A1 b, {9 P5 X0 e
  36. #include <mach/memory.h>
    " C8 C5 `5 o' c' }' e4 _& S
  37. #include <mach/hardware.h>
    5 u0 Q4 S+ t0 }, G+ ^" u/ p
  38. #include <mach/irqs.h>
    3 {( r7 K3 C4 F, F9 D
  39. #include <asm/hardware/edma.h>
    ) m; E  P) Z; F1 O6 N

  40. # e( b6 U# W4 L7 Q- s
  41. #undef EDMA3_DEBUG4 d7 k! s" p8 i- {8 ]( D9 u
  42. /*#define EDMA3_DEBUG*/
    3 M7 f8 T2 ^7 j, r
  43. 6 c. `" Z% D! i" `3 N
  44. #ifdef EDMA3_DEBUG; U( B& ?# e, F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). ]8 b' }: S" A7 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 f1 H  n, v+ f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 }6 g% r; ?  k; U* e: k5 E
  48. #else7 c1 T4 W+ I; x3 g% {
  49. #define DMA_PRINTK( x... ). ?! V/ \3 U. `: U
  50. #define DMA_FN_IN
    + _( X' c& h' A( o& e5 }
  51. #define DMA_FN_OUT; }4 t/ ^* \: p7 A
  52. #endif0 y: u& K- x; O. Y
  53. 5 ~3 ~" S& B2 P$ A- B2 G6 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 S; y0 S& N. {4 A3 P
  55. #define STATIC_SHIFT                30 w) V8 k" p: t* k0 g
  56. #define TCINTEN_SHIFT               20  b( K4 d. U- r8 n
  57. #define ITCINTEN_SHIFT              21
    5 r5 V" k; E! S# V4 Z0 w0 B6 n
  58. #define TCCHEN_SHIFT                22) D2 C3 u$ Q! C; I# D+ O
  59. #define ITCCHEN_SHIFT               23& ~& W2 Y1 W* Z  j5 u; r3 a* K1 g

  60. / ^7 p3 L4 U( Y6 d' B% v# `
  61. static volatile int irqraised1 = 0;
    1 e* ]( _/ O) l$ A% ^
  62. static volatile int irqraised2 = 0;4 ~: a7 V! k* E3 y9 }2 Y6 P
  63.   q/ q* }: Q( e, F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * P; ?! r0 ?# S$ }: h2 D0 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l, @1 n( Z$ S& T/ R9 o$ D9 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- C. q) C, B. a. R9 d. [7 {

  67. ! t. ~3 P3 \7 w# [6 u1 Q' j, e
  68. dma_addr_t dmaphyssrc1 = 0;. }) A  o3 g' c& ~) W8 E
  69. dma_addr_t dmaphyssrc2 = 0;
    + t: L% U) S* }; F9 `9 |
  70. dma_addr_t dmaphysdest1 = 0;; s7 h, I/ ~% U3 g5 i: A
  71. dma_addr_t dmaphysdest2 = 0;
    " Q  N! o: K0 @, e& C7 I

  72. 2 W: t( G- h1 K, A7 b9 ]" t
  73. char *dmabufsrc1 = NULL;; X  C% l- s  f9 Q/ t  `( y
  74. char *dmabufsrc2 = NULL;
    1 W1 R. _2 E  @# K
  75. char *dmabufdest1 = NULL;
    # A1 y* a5 D9 q0 ^# X" k/ Y
  76. char *dmabufdest2 = NULL;# d+ L( N% f- a) h( K' {

  77. ! ~; {( O# u& N8 x! Q7 x* s* q
  78. static int acnt = 512;: Y" r) g, T" H9 e3 u) D( m# ]0 ^
  79. static int bcnt = 8;
    * v, F- b/ \; r  L0 \( E
  80. static int ccnt = 8;- s" @" A: G3 b1 O

  81. - e9 f, f& k! `
  82. module_param(acnt, int, S_IRUGO);5 W) M2 N* A8 c# v
  83. module_param(bcnt, int, S_IRUGO);
    . `1 }- y8 i# U- [  q8 m3 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: _; L. ~& A% [+ S) A/ j9 I

( j- V! L8 H( O# L& E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" U, W$ W8 }% X& w1 Q3 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ n9 Q% q/ D) c/ X2 |$ f2 B  m( ?7 u5 J6 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ f. }1 U4 a/ S; o

% h! P  D4 {; a4 }  O& W/ h8 V* t* T. O- o. Q1 ?* h7 J0 t, [/ H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 05:28 , Processed in 0.039825 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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