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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " E( X2 w9 l8 u
  1. [code]EDMA sample test application
    " {+ R; q0 Q) t; l' m5 g4 N) m) j
  2. /*
    ; S% }) y1 j& w, K; E' x7 N
  3. * edma_test.c) W! e( u% e. N% Z% Q% B" N
  4. *
    9 ?# w9 B- Q* S5 O# `  c2 J
  5. * brief  EDMA3 Test Application
      T2 \; O4 ~- z, `) q! `- S
  6. *
    1 K+ J! K, t7 h: x! s* E
  7. *   This file contains EDMA3 Test code.
    ' R7 E2 q1 {% ^
  8. *
    , d  H9 C' p7 o( p9 `, t& h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 ^& ~  W0 b: h8 O( {- F0 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 Q: Y) ?9 J9 y9 e% Q# Q( R& p
  11. *         TO CHANGE.
    " L7 e8 G' b6 }8 s
  12. *7 l+ J4 y, X5 J  r& ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  C+ I9 p, n/ o# Y, Q
  14. *
    2 }6 V% R5 f  l: }2 h/ I
  15. * This program is free software; you can redistribute it and/or
    + S" }! w1 b" ]; ]0 }" F7 O
  16. * modify it under the terms of the GNU General Public License as
    0 E4 z6 B  k# }4 N
  17. * published by the Free Software Foundation version 2.
    & n: r/ l- u3 _! y( I# N
  18. *2 L7 W1 ~+ S9 N% w* p3 a' S; N1 _" n1 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 ?2 u; P9 _% G9 L1 y
  20. * kind, whether express or implied; without even the implied warranty
    4 T0 f/ Y% S; A1 B4 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , K; f' i! N- A% E2 g  \
  22. * GNU General Public License for more details.
    , U& P9 ^0 l8 c8 B
  23. */
    3 x3 E, |+ x& ?' @

  24. ! o# n' w: T% g) _: _$ Z- B
  25. #include <linux/module.h>
    . e) U. ]0 ~' k2 g/ k
  26. #include <linux/init.h>
    5 u) c  `) ]# n# s+ D1 p* ?
  27. #include <linux/errno.h>
    1 R8 w' k8 V9 _, u! o' J# C
  28. #include <linux/types.h>
    4 K7 ?5 ], k) S# B/ _
  29. #include <linux/interrupt.h>& H, x; q1 N! Z' e. o) w, O
  30. #include <asm/io.h>
    6 _3 a# V7 k* j1 \+ d
  31. #include <linux/moduleparam.h>8 V' H4 \9 c" E  j+ [1 x8 w6 X
  32. #include <linux/sysctl.h>
      x; x2 O" Z, R( H* L( |
  33. #include <linux/mm.h>
    ; l- Z' E$ I7 @
  34. #include <linux/dma-mapping.h>6 G. E2 g8 }4 b/ z0 y
  35. 2 }( v  ~9 G4 z9 y
  36. #include <mach/memory.h>
    2 _9 @  X7 J8 T( a) _% H' O3 c
  37. #include <mach/hardware.h>
    0 {- q  h" J2 y4 B" l; ]
  38. #include <mach/irqs.h>; x2 ~% t( @. M3 ]: p+ j8 h6 S
  39. #include <asm/hardware/edma.h>
    ; v+ f  U0 |4 `" j7 s# _

  40. ) R" C( E, C, g! C* X
  41. #undef EDMA3_DEBUG  t" T. [2 w, ^$ d5 ^2 b. b
  42. /*#define EDMA3_DEBUG*/
    8 w3 X- U+ {" d$ J) n/ b% T9 S
  43. & p2 ^6 r  l4 V) J$ ?
  44. #ifdef EDMA3_DEBUG  b# ?% ~5 t1 i  H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); j, F8 L2 u; P( t  a& t" O0 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . |2 H9 c8 U0 l) F; ^6 r9 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + G2 V$ v+ G5 y" t
  48. #else
    ! G1 S% z+ A" M4 S$ P) h- v
  49. #define DMA_PRINTK( x... )+ v6 J5 f/ F- }' a9 G# _8 Z
  50. #define DMA_FN_IN' b+ N4 Q% i! L6 {
  51. #define DMA_FN_OUT
    5 d5 O" X8 b  X% M3 X
  52. #endif
    1 |2 \- \  V, k5 z  J; c) i5 O
  53. 6 Z9 L/ j/ c; F0 ~: O! R7 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & {" w6 H! O; y7 ~7 \: `
  55. #define STATIC_SHIFT                3
    , d  W0 b+ e( q8 b" b. o
  56. #define TCINTEN_SHIFT               20! P* g* f0 N  Q# I! k
  57. #define ITCINTEN_SHIFT              21
    5 Y8 b9 B; v7 F! v' b+ b
  58. #define TCCHEN_SHIFT                22; A8 u) }$ a7 M! r: ^' H" y- n
  59. #define ITCCHEN_SHIFT               23
    8 X, E' u+ l1 Z7 C4 m+ x7 ^- B. V6 ?

  60. 2 G5 Z1 s: M6 n5 m
  61. static volatile int irqraised1 = 0;
    9 {6 C4 P+ Q  x3 E- |& ~* _6 |
  62. static volatile int irqraised2 = 0;
      e4 O  m) x* D+ Z, Z
  63. , L; \6 M8 c5 k+ d' n, a3 ?3 C$ E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* S/ _& e. A+ b: G5 o) O& k0 N: G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 V* i5 \; C) Q2 {9 {5 ?  ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 i" d8 C) U  x! ~' p
  67. 8 d+ q/ ^5 _9 f+ e7 M
  68. dma_addr_t dmaphyssrc1 = 0;" q2 I0 l! f% V- \
  69. dma_addr_t dmaphyssrc2 = 0;9 Z3 z" m, J9 S) f  z2 R1 H
  70. dma_addr_t dmaphysdest1 = 0;6 C8 l9 O/ |1 H1 @4 F+ Q
  71. dma_addr_t dmaphysdest2 = 0;
    ' }; q* F3 _! Z$ X, ^
  72. 5 C# Q7 w4 [  W9 r3 m- D
  73. char *dmabufsrc1 = NULL;" r# ?8 s$ i. M
  74. char *dmabufsrc2 = NULL;: r! \7 m! B/ o8 M) q- {
  75. char *dmabufdest1 = NULL;, o6 `  |* q' _: F$ `
  76. char *dmabufdest2 = NULL;3 G& c2 b" @: B' T6 L4 \: x$ T4 e6 V
  77. 8 s/ y2 a5 V( _5 [  Q
  78. static int acnt = 512;- z& @; N/ k0 V8 Z8 \
  79. static int bcnt = 8;
    : J' {- B7 z/ j/ Z3 [
  80. static int ccnt = 8;4 o* e# e5 y* w- j; B. U2 B

  81. ; n% b$ x7 [0 o6 `: J! w
  82. module_param(acnt, int, S_IRUGO);/ d& e0 x7 A0 q# G, s/ H" V
  83. module_param(bcnt, int, S_IRUGO);
    % e' G% v, I  ]4 G4 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  F% I0 I5 {& Q" Q5 O0 t
8 \, B# Y) J# |; d" N& N0 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& `& w2 U# k* K% O7 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 t4 u( Y6 z$ n" b2 h. p5 K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 P$ y5 u0 c) o. h3 i# G
1 A) M: U% X- _
( ^) p4 B# w. z" Y; x3 k" D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 21:56 , Processed in 0.039990 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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