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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 K! ]$ E9 F9 H9 \" t# }
  1. [code]EDMA sample test application# \/ `' H' W: n) \" q  o2 S/ {2 J
  2. /*. r& g1 d/ J5 e) h
  3. * edma_test.c
    & ?7 Q2 C2 M) T% a5 r
  4. *
    + f1 I7 e5 h9 ~1 F5 v. O
  5. * brief  EDMA3 Test Application
    , h# h4 @  `* h' {
  6. *0 y* w% j* l. D' d% Y
  7. *   This file contains EDMA3 Test code.: h0 ^5 g* k+ y, y+ b7 w' O
  8. *9 y5 u3 _) C8 B7 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 e9 W2 V- V% F% p0 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" s" ^4 u4 z$ ^  Y
  11. *         TO CHANGE.; M3 r( G- X9 h; i
  12. *% f8 h/ l) k. @' a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; U/ u* g' _5 v; A8 b" U! ]
  14. *
    4 V- H0 A6 U, D( J# X
  15. * This program is free software; you can redistribute it and/or
    ! h  e, \& O2 S% z  ]
  16. * modify it under the terms of the GNU General Public License as
    ; b- Q: W. Y! J2 V
  17. * published by the Free Software Foundation version 2.8 E7 X6 P/ v1 r
  18. *0 M7 `6 y2 d2 x. O1 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ a& e; U! B9 R7 r! i
  20. * kind, whether express or implied; without even the implied warranty
    * A- ~- C/ Y! r: o2 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! |9 m6 [" M+ O* r, y# F
  22. * GNU General Public License for more details.4 {: \0 o( Y, _1 j3 O
  23. */
    ) \3 y9 C: m* B7 t$ M9 j1 z
  24. ! e0 q2 f7 [% b8 w
  25. #include <linux/module.h>
    6 b3 d; {3 s* Q( h7 Z
  26. #include <linux/init.h>
    2 n2 x# x9 J. w+ F, y* S1 H
  27. #include <linux/errno.h>
    ' v0 Z& T- E' J6 V
  28. #include <linux/types.h>
    " B. t# u# `" i  p7 D, B" p; y
  29. #include <linux/interrupt.h>6 v4 y) j' v* J5 f
  30. #include <asm/io.h>3 m1 ?$ Y3 L7 B8 r3 G
  31. #include <linux/moduleparam.h>: N& P2 r; f% e) |( m
  32. #include <linux/sysctl.h>$ f1 Q3 b$ P  l( H
  33. #include <linux/mm.h>7 J( x- r! }, t
  34. #include <linux/dma-mapping.h>" Y# K/ N5 W! u  j8 R0 i

  35. 3 }% b* v( ]0 U+ Y2 [) q1 t0 M( T
  36. #include <mach/memory.h>
    5 F+ l- n2 i7 P9 e% [7 ~. F
  37. #include <mach/hardware.h>
    1 k3 W" G, O1 `5 |- K
  38. #include <mach/irqs.h>
    ( g; g) }( O  d+ P5 l  i& L. ?
  39. #include <asm/hardware/edma.h>
    ! F, @. T6 b" @3 v3 n* r- Z

  40. # P/ \( i! E$ r# q) Z
  41. #undef EDMA3_DEBUG$ i, a9 f/ u3 T/ ^8 E
  42. /*#define EDMA3_DEBUG*/, Z, Y: e3 s$ \1 y3 }, ]
  43. 7 S: W. [3 n! s, N% H# v3 l$ M. T2 @
  44. #ifdef EDMA3_DEBUG
    ) i# f' `, o) K8 y9 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + m: {, ^/ T" k) i) \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # O. L0 d/ O7 O/ L, J5 k( S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 P4 G) H: x3 J% b8 J
  48. #else! g6 m$ s5 v. y. Z
  49. #define DMA_PRINTK( x... )
    3 O( |' b8 W" O" A
  50. #define DMA_FN_IN
    ( [; [' B+ @; [% p% k
  51. #define DMA_FN_OUT- ~: j& s3 V9 s9 N8 ~
  52. #endif2 t9 i1 R" `2 W) j
  53. ! D  B9 H: n, f! Z- [. s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* Z, v* D' V: g$ `6 ?( J; v# E
  55. #define STATIC_SHIFT                3' I2 f, \7 m, I5 n" v
  56. #define TCINTEN_SHIFT               20% M4 Q  B4 X) M) g% N
  57. #define ITCINTEN_SHIFT              21
    " {: x: j1 G/ F/ H1 {
  58. #define TCCHEN_SHIFT                22
    ' L, {# T0 T4 `) T1 R( D& A
  59. #define ITCCHEN_SHIFT               232 c) ]4 F/ k* |% Z+ q$ x; @
  60. * `# m* D1 o. [4 \7 G3 e
  61. static volatile int irqraised1 = 0;% C0 r& i$ V5 M4 V' n; b: Y
  62. static volatile int irqraised2 = 0;- n( f3 s" D! |% B$ o" _

  63. ; R( g7 H" Y8 U7 T  @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # R% M. I2 K9 C. J! t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~( c* |7 B0 ?  F1 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o7 F! K% ?- B  k5 H

  67. / |/ t/ u$ X( I0 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    0 h" l1 y# \3 M- [" {' ^; R
  69. dma_addr_t dmaphyssrc2 = 0;
    : S! x! g5 l) O& O/ r( g
  70. dma_addr_t dmaphysdest1 = 0;
    * `, j  ]$ }2 i! b. f2 o8 q
  71. dma_addr_t dmaphysdest2 = 0;  T1 ?! ^/ g; G* s4 ]; P6 P

  72. , Z7 r% X) \2 U* a4 w
  73. char *dmabufsrc1 = NULL;, g* r4 u( j5 r, b# l
  74. char *dmabufsrc2 = NULL;$ [2 ^7 F; p8 x7 W/ b
  75. char *dmabufdest1 = NULL;: a. I( q& p: O" l; u+ y0 G+ i
  76. char *dmabufdest2 = NULL;
    $ f; W4 n* N8 s
  77. # F% e) D  x: Q. ?
  78. static int acnt = 512;
    + i6 c% ]% V2 U4 v" M
  79. static int bcnt = 8;
    ! b& ^- V7 E' E# I
  80. static int ccnt = 8;0 |" K  J4 T0 v. O" {& q

  81. 1 K+ M! Z, h8 x; t0 k, x1 f% q
  82. module_param(acnt, int, S_IRUGO);  R. n- T2 K$ o  Z3 y) J. T& Z. ~
  83. module_param(bcnt, int, S_IRUGO);; Y; P: W9 a4 q- P* D4 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' u4 a: h4 f6 R& T& k/ K
- Q1 ?- j8 R3 Z) J8 C) E  U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 M% R' e7 {& i6 p( ?3 ~& Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! T3 N+ N7 l* S0 _" f: L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 n) {: u; t3 F- f; o$ G( Y1 ~
, ~  Z6 h( c1 B1 y, j: v
$ y( R$ q2 H. _  m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-19 19:56 , Processed in 0.041321 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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