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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 C# Z) U# q* {) H, ?2 C7 q$ Y( b
  1. [code]EDMA sample test application# C3 S$ ?, P2 ^/ X& Y6 i
  2. /*4 X% `3 d' j, u" @
  3. * edma_test.c+ f" T4 y; O% M& C: U# p
  4. *
    ; z+ y; y# c0 S/ V6 \
  5. * brief  EDMA3 Test Application
    ( X) _1 @2 O' j6 _4 G
  6. *5 n0 G1 A- U6 T! [" Y
  7. *   This file contains EDMA3 Test code.7 Z! I9 @. s& j
  8. *  d! h2 Q/ h: A+ Z8 \. D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 T+ _. o: R0 w+ X6 G3 x7 X% Y# a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ [# I0 S: G  M+ }1 C2 h
  11. *         TO CHANGE.
    ) @% N( ?$ y* W' A2 n
  12. *
    , a) _# q; |+ p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 m3 M5 _. i4 M# a) l7 N2 e
  14. *
    9 L9 _6 }, h* @4 f/ J
  15. * This program is free software; you can redistribute it and/or- E, Z6 t1 ^0 c! j. U7 ?5 O
  16. * modify it under the terms of the GNU General Public License as
    $ k! r( _- i) a) L
  17. * published by the Free Software Foundation version 2.
    $ W4 I, u6 r. y* T# @6 G5 G: a
  18. *9 T2 A5 m5 b0 E3 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% H  i* \4 T- b; d+ K
  20. * kind, whether express or implied; without even the implied warranty! a- i7 I# A0 e$ a/ i0 h2 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- M) T- `  W2 A
  22. * GNU General Public License for more details.8 m! A5 l1 L  h9 m
  23. */
    * I, S/ k0 k5 Q5 f$ v' t
  24. : H) h1 Y* P4 u1 C2 G& t  R1 B! a
  25. #include <linux/module.h>+ B3 n3 x4 O  S5 Q% T1 L# @
  26. #include <linux/init.h>9 W9 {7 u2 }$ {0 k8 b/ ?% J6 F
  27. #include <linux/errno.h>
    9 b. r% `1 F' ~* h5 A' ^7 |) x
  28. #include <linux/types.h>
    . ?1 g$ j: r5 S8 P% Z/ @" \# i
  29. #include <linux/interrupt.h>" n! f+ g, B! b$ C5 V; @) [
  30. #include <asm/io.h>& |  p) R" k. z: Z# ]
  31. #include <linux/moduleparam.h>
    $ ?5 e' _$ P$ K
  32. #include <linux/sysctl.h>, Y8 E( A% s+ E" @& R! |' Y
  33. #include <linux/mm.h>
    3 z0 u; `) A. }1 [
  34. #include <linux/dma-mapping.h>0 |. r% h/ W* U( z) g7 R0 z
  35. 6 ]! L& t$ u) N% {: u
  36. #include <mach/memory.h>
    7 Y9 [% r4 }; n  J/ p; V
  37. #include <mach/hardware.h>
    . N" H3 ]7 v2 \. c
  38. #include <mach/irqs.h>; O+ y$ A$ R0 i: n4 j$ G
  39. #include <asm/hardware/edma.h>
    6 B$ k: M/ e2 I' c+ J' w; G* b0 x$ Z
  40. - @2 {9 ^" Z0 w2 W: q( I( X3 A
  41. #undef EDMA3_DEBUG; q7 J! P3 R' E5 |* [" {
  42. /*#define EDMA3_DEBUG*/5 C( s- t0 z& t- r

  43. ; m8 o  D! r$ [6 t
  44. #ifdef EDMA3_DEBUG
    ( @. c" ]/ F# V) J( }, U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; m" O. P1 u8 z  C" W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( _* W! z0 U: ]% f' ^* i# D1 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ P! w8 A$ i; b6 m. F8 I
  48. #else
    8 [3 f% ]$ ^3 E
  49. #define DMA_PRINTK( x... )- L; _+ z4 X  ^- Y8 v1 @* D
  50. #define DMA_FN_IN- ~2 C+ B/ u+ t# I
  51. #define DMA_FN_OUT
    # g6 G( p7 J! r
  52. #endif! G/ K  U1 _* T2 q: N; C/ g

  53. 3 w' p! A$ d  [' }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - Z; H, n+ A) P: k, h% v
  55. #define STATIC_SHIFT                3+ |& C3 j4 W: @# H5 k
  56. #define TCINTEN_SHIFT               206 {5 F7 |# Q" ~$ ^6 j; ^9 }
  57. #define ITCINTEN_SHIFT              21
    - b( V0 m4 P" h
  58. #define TCCHEN_SHIFT                22
    + i6 o( n# ]7 J5 m; `
  59. #define ITCCHEN_SHIFT               237 d) v$ w3 |( p, U$ t7 \; [
  60. ) ^& a* y) h6 h- y9 v
  61. static volatile int irqraised1 = 0;4 C0 [. h1 u8 Z% `" ~1 `
  62. static volatile int irqraised2 = 0;; h% I5 Q- |  [# j- m$ p% ], O$ \

  63. $ l8 i- A# U# M' }9 Z% j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ?7 x4 a1 V' G/ X; v! b' T0 T- _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r% A4 ^# r+ C0 W9 V5 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& F9 y1 T) J) l, k) s

  67. 9 ~3 P/ h, ]2 F5 B
  68. dma_addr_t dmaphyssrc1 = 0;. r1 I0 F2 P( M: a9 R
  69. dma_addr_t dmaphyssrc2 = 0;
    # A1 q9 {+ r! U6 I
  70. dma_addr_t dmaphysdest1 = 0;1 Q& g  n" _* A1 l
  71. dma_addr_t dmaphysdest2 = 0;
    2 e# A8 y  K  F% m# J9 N
  72. ' Q8 i; I( p$ O2 J( O' q
  73. char *dmabufsrc1 = NULL;( e& _2 Z9 G% c; v0 z0 d
  74. char *dmabufsrc2 = NULL;( w9 U3 \0 m% Q( k( K
  75. char *dmabufdest1 = NULL;
    8 C! O+ Q( Q1 m, D' ?9 x* b& A; u
  76. char *dmabufdest2 = NULL;
    " h- `6 v) ?; _$ V

  77. 8 N6 `4 }4 F4 J( z( r5 j
  78. static int acnt = 512;# x" |: U' |. U
  79. static int bcnt = 8;) F; Q4 i8 M( ^3 o- Q
  80. static int ccnt = 8;3 E) P3 w5 T5 o; i! N
  81. ' p" J6 Y: X' {3 x) a
  82. module_param(acnt, int, S_IRUGO);
    - V: U; y1 _$ h
  83. module_param(bcnt, int, S_IRUGO);
    2 d3 e0 E4 ~# \& G# n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; z3 A7 `1 p% W/ h8 s( v( z9 b$ X6 r0 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' _$ E' t+ W. F; Y' X6 v& Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 e5 E4 N$ E8 v$ H! a5 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) k6 {7 C# a9 F6 l* a1 l
3 P! u7 `- p4 u# {" d: m
( L0 u: _6 n# ]/ }8 Q/ h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 20:20 , Processed in 0.043599 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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