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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 c+ ]: k' H0 F  u" E7 y
  1. [code]EDMA sample test application% B- a. j! j8 Y1 G9 g- o+ g
  2. /*% A' T8 r5 K& v- @/ Z- Y+ d. j
  3. * edma_test.c
    . O4 L2 ]+ q! A- a0 i: y6 |1 \
  4. *2 H' E6 ~4 k7 k3 l! F% m3 v$ ?
  5. * brief  EDMA3 Test Application
    - Y% e( T' J& a  ?
  6. *
    ) q; m8 m) w6 E) Y2 f, |
  7. *   This file contains EDMA3 Test code.; `: z1 t- j9 A# w
  8. *
    / P5 f/ m  x3 g( j+ s/ I' H" h3 Y7 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : P3 N6 \' a; \2 r, L' g# l1 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 S4 f4 _5 i0 F; a: I4 q
  11. *         TO CHANGE." Z& X; X7 D8 Q4 f/ E
  12. *
    5 b# Z6 d. [$ J  ?7 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 t$ i+ K8 f8 J& b7 ]
  14. *
    ! n4 o" ]/ C5 m. ~) K
  15. * This program is free software; you can redistribute it and/or
    9 C  i) h% W) y( c7 D
  16. * modify it under the terms of the GNU General Public License as6 h9 S9 l1 U+ @* Y) I3 c$ T1 r
  17. * published by the Free Software Foundation version 2.' x# _$ b3 L- z* M
  18. *
    : r" r5 i; Y# X$ A" S! m$ Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 @' H- b4 M  ~0 J3 d
  20. * kind, whether express or implied; without even the implied warranty
    ; o1 G7 d& y. T$ D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 U1 L2 u( O# J9 D7 n; Q
  22. * GNU General Public License for more details.
    5 d$ B' I! t; L9 e6 [
  23. */
    / U7 m8 r) {7 \/ T
  24. 7 b) a/ [- n% `  B, }
  25. #include <linux/module.h>2 y7 N! X8 G: K' I7 J
  26. #include <linux/init.h>6 Z) A! u: a: k( B
  27. #include <linux/errno.h>; W% F8 n2 f& R3 N! a* z8 c8 Q
  28. #include <linux/types.h>
    6 Y' k4 o" E2 _, T# ?
  29. #include <linux/interrupt.h>
    - w: L. ]. R" X) S' F$ N( o5 n+ ?
  30. #include <asm/io.h>
    ! m7 t: P) i2 f
  31. #include <linux/moduleparam.h>
    + o6 L$ D3 Y& x7 d
  32. #include <linux/sysctl.h>/ D" |9 q; t% b% O
  33. #include <linux/mm.h>& @- a* q- z! H0 V7 H2 N3 [
  34. #include <linux/dma-mapping.h>8 p8 t6 Q# P) n, K$ T1 u+ A
  35. , h: Z" @# ~% s
  36. #include <mach/memory.h>
    ! ^" M+ [8 n9 L
  37. #include <mach/hardware.h>1 e- H- Q, Q' d0 O% y3 y& W
  38. #include <mach/irqs.h>% A/ j6 B/ v/ P" U8 }# i1 Z1 W
  39. #include <asm/hardware/edma.h>( O$ Y  C: m  i. \

  40. 1 _/ _7 j8 i5 Q: J* ^6 n& v3 d& |
  41. #undef EDMA3_DEBUG
      o0 `& q: r6 C
  42. /*#define EDMA3_DEBUG*/9 r0 K7 W: K8 k. W8 T) {
  43. / C, D- V1 q" a, X% E
  44. #ifdef EDMA3_DEBUG
    $ w% m( j2 i4 A5 u; y8 ?8 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # U8 _5 E  S: z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % @* Z) w+ N" ]" G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 r+ d' \6 j; q# U1 k  e0 l4 A
  48. #else
    3 `( L4 o# w; }, K
  49. #define DMA_PRINTK( x... )
    & [# Q% }0 ]& k# _  v
  50. #define DMA_FN_IN
    # {; k8 l- V: _& y$ Q" j  k0 l# L! I
  51. #define DMA_FN_OUT
      q4 R' e; y* g! T: @
  52. #endif
    / L* P: G# G) C: S. a

  53. , i' K2 p; y$ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' I7 W+ R- f2 {/ \7 T
  55. #define STATIC_SHIFT                3. t* e* F. r' V. D  r7 R* O
  56. #define TCINTEN_SHIFT               20
      n) u/ ~8 U1 H$ D
  57. #define ITCINTEN_SHIFT              21, P5 x& d0 [, R5 g# w/ h4 x# v6 e
  58. #define TCCHEN_SHIFT                22! z; s( |" x' L" n
  59. #define ITCCHEN_SHIFT               23: i( N+ S/ v& ^3 M
  60. 3 c5 r2 A: M8 B: H
  61. static volatile int irqraised1 = 0;% f  L! F7 G) ]6 i, r
  62. static volatile int irqraised2 = 0;
    3 l9 ]2 O( b2 k3 |0 ^% S+ |
  63. ) F: {  \2 |! V" u4 I% O7 Z/ H9 I4 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 M  w5 {8 F7 s  @0 z- Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Z1 E* {- `1 ~  _5 I: d+ A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 {6 J: o0 c# I$ Y$ {

  67. ! {- q  {0 R; s( u# \. a+ n
  68. dma_addr_t dmaphyssrc1 = 0;5 ~3 t! W- c. ?+ Z, H2 W( u
  69. dma_addr_t dmaphyssrc2 = 0;% K# u' q1 H( `8 \
  70. dma_addr_t dmaphysdest1 = 0;2 X5 j) ]% S$ g. G
  71. dma_addr_t dmaphysdest2 = 0;
    5 d0 y4 g0 S) t! W5 n9 O1 |

  72. 9 y% z3 y6 I: n: a) I9 X
  73. char *dmabufsrc1 = NULL;
    9 G' |# s1 f/ r  Y8 i5 q: D% h
  74. char *dmabufsrc2 = NULL;1 w! o1 Z0 u2 K2 {- p  l/ G) k( k
  75. char *dmabufdest1 = NULL;, U+ f+ m0 Z& D8 M
  76. char *dmabufdest2 = NULL;
    " i1 U% d/ l# I( k, \
  77. % T' W, M: D* u  @9 y! L$ ]: F) `
  78. static int acnt = 512;
      a7 ?2 {$ K! n/ S. ~  g8 w/ g
  79. static int bcnt = 8;; [! `8 [4 e+ }: k2 x! U- ?
  80. static int ccnt = 8;; e7 {! E5 ~% G' n; z% `& B

  81. ; [! v  n, L3 c9 c) r6 S' T! }
  82. module_param(acnt, int, S_IRUGO);4 b+ `0 D1 f: R& X4 q2 p5 w, \& A
  83. module_param(bcnt, int, S_IRUGO);1 @9 Q8 j  D, {& }1 K4 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, B- V+ {3 O- f* |) h
  O9 r9 L1 t" P9 R  B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# w; u8 e" i/ F7 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 r5 H- m& D1 t, T! h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. g* O7 z9 q' ^3 g6 L
. O# B7 }$ o$ _
4 E( n& N: g, f2 d8 F( i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 12:31 , Processed in 0.039920 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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