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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  v3 `9 n. u# s/ Z
  1. [code]EDMA sample test application* {# o: l8 E$ t, A1 w/ B
  2. /*8 H8 o: k- i0 |# K7 ]5 k
  3. * edma_test.c
    % N1 K+ z5 Y/ T6 ]6 |+ u3 A
  4. *
    3 M3 b7 d' P3 K9 g1 w
  5. * brief  EDMA3 Test Application; J- p/ P2 b& N/ b' A6 R  `
  6. *
    9 N7 ~) c  y! @. Q; [
  7. *   This file contains EDMA3 Test code.
    1 m- l" X8 {4 _. h* o9 P" o& ~
  8. *
    ( t+ A6 M9 k4 `% u7 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 F) w: j+ M4 T1 p, [) b4 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: L' i. E, w3 O5 m3 U2 B$ O9 L1 q
  11. *         TO CHANGE.
    5 g  Q* v. j  l0 w) G1 b0 k/ t
  12. *
    8 s8 @' ?9 p; ?" }1 O9 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 T6 Z/ O) {* k* f7 P3 Y( u
  14. *
      i+ J" n4 E6 B6 U$ y  F+ H
  15. * This program is free software; you can redistribute it and/or7 Z5 q2 a2 }9 p& P
  16. * modify it under the terms of the GNU General Public License as) `" W  O1 _, ?/ j# ?
  17. * published by the Free Software Foundation version 2.5 ]( c5 q' R$ B# ~# {* c$ }
  18. *! U- m# p$ S3 H8 W4 X' ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ^) O: L4 i; i" r
  20. * kind, whether express or implied; without even the implied warranty
    3 |! R! ?7 I/ T$ X2 _4 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & q) W( S! t; s8 D! i
  22. * GNU General Public License for more details.
    0 P7 a: O& j* k
  23. */
    3 x3 ^6 B9 w8 q0 k' q
  24. * d- W9 {$ j: I( q( {
  25. #include <linux/module.h>
    # {# a  N, f: j- \! R
  26. #include <linux/init.h>. Q. X$ S' B! |# L' J  g4 b
  27. #include <linux/errno.h>
    6 Q7 ~. W' l  f3 T& _
  28. #include <linux/types.h>1 B4 a2 N# q/ _( K+ P  k- }. _
  29. #include <linux/interrupt.h>
    % t2 {  R* S; D1 S- M* A$ ~2 _# @5 I
  30. #include <asm/io.h>) B0 P# I$ ]+ e4 r5 r+ V
  31. #include <linux/moduleparam.h>
    " b/ ], _2 r6 b4 |. ~7 h
  32. #include <linux/sysctl.h>' i# }) q/ B5 M) O
  33. #include <linux/mm.h>0 a5 L4 j0 a6 w2 |
  34. #include <linux/dma-mapping.h>4 B2 y) i! R- n: Y% j" v

  35. : k. w- b' B7 w
  36. #include <mach/memory.h>
    ; T  R) \7 M5 k. z( t" ?# E
  37. #include <mach/hardware.h>
    $ d: b7 D  C+ h4 F" |* z
  38. #include <mach/irqs.h>3 v! A' c/ u9 T" l8 ^% s9 ~$ _
  39. #include <asm/hardware/edma.h>5 U  e) p* N6 M# M! `
  40. - C4 X; Q; N, E& J& A, i
  41. #undef EDMA3_DEBUG
    + O+ \4 E1 {3 O* v& [& B
  42. /*#define EDMA3_DEBUG*/6 b9 q4 Y% {& d4 F% D  {
  43. ; l0 f* D% @- W/ y7 R
  44. #ifdef EDMA3_DEBUG
    ! @5 v8 }6 Z* M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : b. X& W* U" Q5 R% @- d6 `/ r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 Z; q6 u. Z  _# y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; u! ^- ]+ W2 M# d$ P
  48. #else& Q5 U, S# I- O" l2 f7 S
  49. #define DMA_PRINTK( x... )
      y5 }) D% U* A
  50. #define DMA_FN_IN
    " V6 ]) ]/ e& d" o2 Q
  51. #define DMA_FN_OUT& W4 q( b, Z& n( Z$ t
  52. #endif
    1 @0 v9 p9 W" s# D
  53. 3 \5 T' i6 t5 P4 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) l3 z# F5 L& E. M/ U/ F
  55. #define STATIC_SHIFT                3$ a3 g/ |$ [2 m: t5 r: W1 l% q5 W
  56. #define TCINTEN_SHIFT               20
    - o9 l* B' V9 w0 D" _# a- i4 L  q. I
  57. #define ITCINTEN_SHIFT              21# \$ T0 Z1 N9 |
  58. #define TCCHEN_SHIFT                22
      V) |$ f, J; h8 q
  59. #define ITCCHEN_SHIFT               23, N2 Q! e2 B0 Y9 H5 U! y& K
  60. 0 w1 l* f, S, [2 Z, n! G
  61. static volatile int irqraised1 = 0;
    # `2 D" l, w2 {2 e% Z  {( j
  62. static volatile int irqraised2 = 0;
    7 S" o' S: u* B* S6 ]. ~
  63. 6 F0 R2 x3 U6 _* N0 s1 O% E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / b. ~* r6 J! `) R# f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j- P! P. I' \" c. Q% j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 i; n8 x; r3 r9 q5 {8 o+ `1 }  t

  67. & f- d# |' g5 b) v3 O
  68. dma_addr_t dmaphyssrc1 = 0;9 E- z& F2 Z6 J) x9 K$ O# M
  69. dma_addr_t dmaphyssrc2 = 0;! z' g* g- M+ j0 h7 n/ O
  70. dma_addr_t dmaphysdest1 = 0;
    : s3 A/ ~, a  M) ^, [
  71. dma_addr_t dmaphysdest2 = 0;
    8 Q( t3 n8 }, V) X2 S
  72. 9 T1 j! e8 K( k
  73. char *dmabufsrc1 = NULL;
    ( b* f5 V4 ?# U# \) C
  74. char *dmabufsrc2 = NULL;
    5 `/ z4 h. [2 F5 a" I& R( q8 O
  75. char *dmabufdest1 = NULL;5 u( e, P& S* i3 R& f- P- l
  76. char *dmabufdest2 = NULL;" s& J3 b( x1 M7 C2 o4 }& l+ V" x
  77. ' Z& V' m# v* l5 H/ n9 v/ ?+ q, X
  78. static int acnt = 512;
    ! v, ]6 D( k8 _6 j6 d# r: K5 l$ z6 F) V
  79. static int bcnt = 8;
    ( l' u% P3 p3 a9 r
  80. static int ccnt = 8;& ^% V+ b$ L  Z

  81. - ~- m0 p; l1 y' L
  82. module_param(acnt, int, S_IRUGO);) J/ f: P2 x: N6 n( ]5 `2 Y
  83. module_param(bcnt, int, S_IRUGO);( Y; s- E( k" h3 P) ~/ {( {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" J8 C* J% b6 b0 N" @% A& c" C; w- }- c- t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" V% T# r5 K( }  oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  S% t3 ^! G8 r" I1 g8 |, ?9 a$ [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 B( D/ d' ]# ^; J) l' V9 E: n5 V! g8 g3 `6 r$ t* b

' S' T& l( A* `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 15:25 , Processed in 0.041871 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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