OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% U! {9 w( u3 ^
  1. [code]EDMA sample test application
    , q2 b$ o) n1 ^; J
  2. /*
    3 {3 s1 j- U2 B  I' k; g' e0 y
  3. * edma_test.c. d) `. ?' v) K, _- ]- W- H. Y
  4. *  z- v8 R' {, s
  5. * brief  EDMA3 Test Application+ ], {! f. ~. P# ?& T+ s% C
  6. *
    ( D' S+ n4 o3 y, e8 h
  7. *   This file contains EDMA3 Test code.  M! N& p1 r9 t7 d/ j' s" v! U
  8. *: t3 @( C) R+ A4 q& J1 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 X; h0 a( \3 Q7 m2 B6 [0 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; o6 e; p5 k" I
  11. *         TO CHANGE.
    5 g; t7 F4 f4 C1 ~
  12. *# ?  [! P3 `, v7 u5 R* u; g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 Y. D- J4 D% W& \
  14. *
    & V& D# @" S. D, e  s1 p
  15. * This program is free software; you can redistribute it and/or
      r2 g2 d) n0 u. R9 n9 h
  16. * modify it under the terms of the GNU General Public License as) ^; }% F: o8 L, t2 B/ D1 @, ~
  17. * published by the Free Software Foundation version 2.
    * s" e* r4 w6 o% m' l
  18. *
    + k$ |; B+ B' e! s7 W1 A% z' u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 p6 T/ j0 j( h
  20. * kind, whether express or implied; without even the implied warranty, |" z4 A8 i; S. f+ ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 Q. m% `/ T) n# e0 i5 U* G
  22. * GNU General Public License for more details.
    . ^! @* r, O4 l$ C
  23. */+ Q; W" U* _) t* H, p

  24. 8 \" T! Y& w0 U# H
  25. #include <linux/module.h>
    $ E0 C8 ^/ _4 `# X, i
  26. #include <linux/init.h>  f$ k0 T2 j; |" L
  27. #include <linux/errno.h>- [* _% v$ q2 U- T( \/ X5 y7 k$ |
  28. #include <linux/types.h>$ l7 p: W  s6 X' ]/ j
  29. #include <linux/interrupt.h>
    $ A  h  m; V- _. I/ n% w& f
  30. #include <asm/io.h>& N1 f8 {) D  s& e* e4 ?
  31. #include <linux/moduleparam.h>  J$ [6 G+ F4 k4 Q( g$ N
  32. #include <linux/sysctl.h>
    * ~  U) _2 ]5 L
  33. #include <linux/mm.h>2 V5 S8 T. V. f( U1 G. R# }! d% |
  34. #include <linux/dma-mapping.h>2 n9 o9 ?7 V; [0 n

  35. 2 n( @% p0 V  o# a
  36. #include <mach/memory.h>
    ) W1 T6 b0 m  K+ h
  37. #include <mach/hardware.h>
      F- F* Z9 s5 J
  38. #include <mach/irqs.h>
    : h7 ^1 E" n$ z$ }2 w
  39. #include <asm/hardware/edma.h>4 g, M  g- m6 D

  40. . H# L' d0 ~6 Q, f( ~6 c! R
  41. #undef EDMA3_DEBUG
    / `# P+ r) b6 _# }; ]0 A! G
  42. /*#define EDMA3_DEBUG*/
    ) F: x; Z( x, ~2 v5 o6 i* m' X

  43. 0 {& k- B2 s4 A: |: [
  44. #ifdef EDMA3_DEBUG% {5 H/ {7 F; w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 \2 W, Q/ v0 e1 z8 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 {3 h; ~+ B( q0 B; `# {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 L' n# v/ c+ v& j& H
  48. #else' C1 @0 K5 ?" R1 W3 A; ?3 j
  49. #define DMA_PRINTK( x... )* f( @+ V! f, B, N2 L) [" b
  50. #define DMA_FN_IN
    ; W3 x: G9 v0 R5 K2 c2 C$ P9 D
  51. #define DMA_FN_OUT
    9 D, `) ^) }* A" m1 m
  52. #endif
    + g. u8 C, q, @: E

  53. $ I0 G- X2 m9 S* E9 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 b' }; I; r# o" a5 l" r
  55. #define STATIC_SHIFT                3
    ' e6 }1 N5 `9 E$ L
  56. #define TCINTEN_SHIFT               20$ f' J3 a3 _3 f
  57. #define ITCINTEN_SHIFT              21
    ' U2 z8 o0 O2 N7 d, I5 w& a
  58. #define TCCHEN_SHIFT                22
    2 b2 t, e% \: M$ K% j9 I+ P% g
  59. #define ITCCHEN_SHIFT               23
      W6 @2 t' F- Y4 L- z
  60. 5 e! ~1 d8 u2 j+ [
  61. static volatile int irqraised1 = 0;3 u: l4 r8 L. f5 `6 M% T2 R
  62. static volatile int irqraised2 = 0;+ f: f5 Z6 V8 E0 y/ R
  63. " T- k) p% R' X. U! J0 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . r3 o6 R* y  i; ^' j# q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 p1 o' e- j. N1 o/ K: P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! m+ ~* f+ |( ]2 R; |  i! c
  67. 6 l1 m! f& q! Y  g
  68. dma_addr_t dmaphyssrc1 = 0;% `4 o, i# i+ G( S" y" l4 v
  69. dma_addr_t dmaphyssrc2 = 0;, U4 Z0 t; r) z5 {3 d" \7 r
  70. dma_addr_t dmaphysdest1 = 0;# ~# J; M4 b- B. u
  71. dma_addr_t dmaphysdest2 = 0;
    ( X6 Z( }7 r$ F- Q9 C! [

  72. 4 K9 {/ ~6 q! D: Y, a
  73. char *dmabufsrc1 = NULL;. D/ r# D: V& }& f
  74. char *dmabufsrc2 = NULL;+ k# [1 c1 k: [. Z- J* A
  75. char *dmabufdest1 = NULL;* T& t0 K* c. P) ?
  76. char *dmabufdest2 = NULL;
    6 I( I: g5 X. e0 }3 Y
  77. $ N" k& u  E* y0 G" ^
  78. static int acnt = 512;
    4 z' X, `2 C. e) B, u" B4 Q4 @
  79. static int bcnt = 8;
    : J1 G9 `4 V( G6 Z
  80. static int ccnt = 8;, g1 x& `) i& n3 v
  81. 7 s  [) j! y. L
  82. module_param(acnt, int, S_IRUGO);- o) S5 Q2 `4 z9 t, v! @* Q
  83. module_param(bcnt, int, S_IRUGO);
    3 g% L* }$ G1 k6 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ T) f: J8 x& B

% ~; c/ S. z4 Y7 A2 c. e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  Q" ]3 R% A: c7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 V+ n; y$ n, z0 B. @; B  Y4 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 t6 s! W; N1 k+ _$ k8 b1 }- f3 |* t7 L, J

' ~5 x7 W1 R1 q$ ]3 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 01:53 , Processed in 0.049229 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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