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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & n& n% T: K* K7 U
  1. [code]EDMA sample test application) r7 d0 J% k6 r0 u
  2. /*9 ]3 C5 N$ E+ N6 W
  3. * edma_test.c+ i9 l2 [5 V8 q( R
  4. *
    9 d! v: }+ y& j  t1 p' V
  5. * brief  EDMA3 Test Application
    % n. V7 C2 s5 L% t0 Q# n
  6. *, d* S# B/ q/ ~( Y0 K& D: K
  7. *   This file contains EDMA3 Test code.
    # M  D- w' H* f% R8 [
  8. *
    - L! x% K0 S/ d/ z6 |. i; Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : k  t! s8 X4 _" R! ]/ W9 Y4 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; T$ `/ b) _$ A9 B% c
  11. *         TO CHANGE.
    5 n+ H/ m$ ?: l! i5 @
  12. *
      [$ L0 ~! V; A0 K. b+ @# ]/ e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 Z- _) U! O) s
  14. *: r2 r+ {5 @) {0 e  G% V' P/ ]4 j+ i
  15. * This program is free software; you can redistribute it and/or
    : v0 R. F) J" ~0 ~& o
  16. * modify it under the terms of the GNU General Public License as
    ; {" ?, H/ |# ~6 B% z0 T' d( U
  17. * published by the Free Software Foundation version 2.
    ! }  b, _8 y8 F
  18. *
    ' w& o6 `2 s! ]! q: k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 |9 _% r1 R! z0 j$ Z& U
  20. * kind, whether express or implied; without even the implied warranty
    3 G. e) N8 B" K% h+ ~1 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, y$ H7 q2 l5 @- b: A1 ]' R9 p# r
  22. * GNU General Public License for more details.( w, N" s' [2 i7 n# Z
  23. */
    2 t- p3 J# M+ Y+ ?! F& D6 d. E

  24. ( C& ^! i$ z( t
  25. #include <linux/module.h>) C  r( @* Y$ f" T
  26. #include <linux/init.h>
    9 c& ^; N9 K9 h
  27. #include <linux/errno.h>
    ( H: T7 Y) I% ^  @' p$ W# q
  28. #include <linux/types.h>
    ! I' m) p5 ^0 D* ~" L
  29. #include <linux/interrupt.h>
    + O6 Y3 E) D* M# F9 q3 S
  30. #include <asm/io.h>+ Q5 v* J1 I) w1 E) s3 }* n0 l
  31. #include <linux/moduleparam.h>9 y8 B# B4 o" u1 B! H! L; E
  32. #include <linux/sysctl.h>5 n/ s  J2 e/ f+ C
  33. #include <linux/mm.h>) b! H& Y: x2 }
  34. #include <linux/dma-mapping.h>/ v" Q6 f$ K6 w9 p

  35. , s, D& n1 w5 g* }- w* @
  36. #include <mach/memory.h>
    $ A6 K( F1 r/ x1 m1 B4 Q
  37. #include <mach/hardware.h>& B, M5 }. y* p1 V; f
  38. #include <mach/irqs.h>$ b. A, x. E& \1 C& S+ [
  39. #include <asm/hardware/edma.h>
    2 A5 c4 U4 E7 o1 y2 b2 I4 \+ ^
  40. 9 |; O' V2 @* O5 [5 u6 Y4 P
  41. #undef EDMA3_DEBUG2 \2 ^2 G& C7 V0 i
  42. /*#define EDMA3_DEBUG*/
    " v1 K) M/ W: |! l9 S# [" I! C% q

  43. 7 E# p8 G" n/ q2 [$ Q- w
  44. #ifdef EDMA3_DEBUG# F7 n$ c/ \+ U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ |  c  F6 R. A1 x+ x" Y0 M6 e9 c# z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). z) ?" T. G1 j6 h% k, O" K4 ^2 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( X2 i( }% H& b5 d
  48. #else2 k% y( ]0 w3 T7 p! C- I1 G
  49. #define DMA_PRINTK( x... )
    1 e7 m, u# ]$ o9 E) P
  50. #define DMA_FN_IN- j  |" K) q& Y* W) ^0 o
  51. #define DMA_FN_OUT# L: T( k4 X3 M  z
  52. #endif
    ) g: x) q' s8 m( P2 u

  53. - k8 Y( w: j2 @; A& ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 `2 s$ R) U+ \' [
  55. #define STATIC_SHIFT                35 e# ]$ W5 e: D- h3 V- y. t8 E& ^0 W
  56. #define TCINTEN_SHIFT               20
    8 N* \) ~+ d+ j  ?' \
  57. #define ITCINTEN_SHIFT              21% T. c/ G6 }3 A
  58. #define TCCHEN_SHIFT                22- _/ I( f4 g$ K- O
  59. #define ITCCHEN_SHIFT               23
    / D: a4 s+ _, [. L. Q
  60. $ B8 R+ u  z/ U  ^) m
  61. static volatile int irqraised1 = 0;
    ' @7 G- {- k! y5 [& H& C. g
  62. static volatile int irqraised2 = 0;$ r# I9 E! i# `6 F8 m& ]3 t

  63. 3 A7 F' z- i# m. s0 I( I6 I4 D" B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N* B3 {# o$ S# o4 j+ ~- p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 T. r" M. m/ v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ q' u- m/ B6 Y0 }+ Z# U3 }) h4 ^# @
  67. ) U* b$ W- v' v! ]- W2 V6 `
  68. dma_addr_t dmaphyssrc1 = 0;9 q4 E8 t% F" I; @, w
  69. dma_addr_t dmaphyssrc2 = 0;
    5 G2 u8 T6 w6 r' i- {
  70. dma_addr_t dmaphysdest1 = 0;" ^) ~9 d$ d* J2 I4 s; s
  71. dma_addr_t dmaphysdest2 = 0;# ~$ W  R3 x$ {1 v% }6 F6 q
  72. 1 D1 S6 t/ m7 [# x8 d8 V
  73. char *dmabufsrc1 = NULL;
    + G  U3 H8 k- b8 I0 w2 M: b( A
  74. char *dmabufsrc2 = NULL;
    * r+ W5 ^- a' ]. [
  75. char *dmabufdest1 = NULL;
    7 j1 k% y5 \( c' m( p4 u  }8 |
  76. char *dmabufdest2 = NULL;
    : i5 \* P( K8 W) _1 f' \
  77. / g; A& v) N" z# b9 \
  78. static int acnt = 512;
    / i7 y2 _8 N5 p) `' k
  79. static int bcnt = 8;* ~9 j& a+ Z/ M$ F4 i4 w. P
  80. static int ccnt = 8;" T" c0 x$ U) a
  81. ) m3 N+ b# F: T% M2 r7 Y
  82. module_param(acnt, int, S_IRUGO);
    ( D$ G4 }: {5 j* ^
  83. module_param(bcnt, int, S_IRUGO);
    9 e. `6 F: G  }7 A+ E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ Z2 _6 n) A% E6 h# \
# s' s5 d' k+ n" O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- G6 ]1 ^( C, I+ Y  V. o5 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! j# d, e2 H, A( d5 d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 I0 q5 m" H. e# u+ f  U
" {" T- s2 b" w9 {2 Z, T
# N, p4 o- D7 W/ I$ r0 T9 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 01:58 , Processed in 0.040939 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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