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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: b1 N2 }& h& K8 \- n" C
  1. [code]EDMA sample test application& E" @# Q( }, y  h) v) r
  2. /*" n* M% O- N* O5 n8 j' }' P" c
  3. * edma_test.c$ \5 c2 w  X) ^
  4. *
    ' W, h0 J/ @+ [) H7 N: Q( k0 c% P1 v
  5. * brief  EDMA3 Test Application4 x3 `2 Q+ C8 |  {  _" e
  6. *. f8 m9 {6 s. G4 R1 ^; S  \% `
  7. *   This file contains EDMA3 Test code.
    - J0 Q; K; q, p; _! q
  8. *
    ' k0 _, l$ ~- K% Q' p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " J5 K/ y8 x3 g7 C. F6 t0 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. E% X" T! R" p8 @5 F2 P6 p
  11. *         TO CHANGE.
    / I; u5 A9 n3 P$ `: E
  12. *
    3 t  P2 C% s, ?% l. h3 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! \1 O7 X/ X/ D5 g" i2 v- v6 L
  14. *
    8 p. [2 a1 O- n2 B5 F, `  X
  15. * This program is free software; you can redistribute it and/or
    ' M4 I' e3 |. j7 B
  16. * modify it under the terms of the GNU General Public License as7 i/ g7 X9 P0 y
  17. * published by the Free Software Foundation version 2.) A1 N: H: e) c3 V" n0 u* K! f. D4 O
  18. *
    , T3 g/ }7 V$ w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% f$ S5 ~# o: I* y, C$ H1 y  h
  20. * kind, whether express or implied; without even the implied warranty5 f& C$ {1 y! P9 [% M! x* ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # k: P3 M2 i- ?# U% U
  22. * GNU General Public License for more details.! \' h' `& ~2 e& }. I# x6 V  u0 ?5 K
  23. */
    5 m9 j7 w) l$ o' {% \  E5 P

  24. & Y1 H- K: h# {; v+ E' X
  25. #include <linux/module.h>
    & A; h# y" ?$ Y) F9 A
  26. #include <linux/init.h>7 {7 v0 E! ?3 G
  27. #include <linux/errno.h>& i7 D* Y7 k8 J4 m- g% V
  28. #include <linux/types.h>1 u. M; t5 H/ T  T# R
  29. #include <linux/interrupt.h>  r( j$ ~, W  T5 I, }# Z) n
  30. #include <asm/io.h>
    & i( O' r9 Y  e& _" l7 w9 n7 W
  31. #include <linux/moduleparam.h>
      M+ a/ P1 C$ A) }7 U4 U& L# b/ e
  32. #include <linux/sysctl.h>  Q2 U$ b2 w( i* B
  33. #include <linux/mm.h>
    2 B0 ^  r- C" v( I7 T; `
  34. #include <linux/dma-mapping.h>
    # j) f/ [! q. V

  35. 9 b3 @( Y3 b* _% n  @( \
  36. #include <mach/memory.h>9 y  }" ^& Y* v0 [' i
  37. #include <mach/hardware.h>( m8 x. Z8 f# X  j0 {% Q; I! U
  38. #include <mach/irqs.h>- W. L& b" O* [9 \9 U& \% f# s" c
  39. #include <asm/hardware/edma.h>
    ' A1 |" h/ s0 s3 h1 A5 j8 c! j
  40. 8 l  R- D" V+ `. `0 @+ b
  41. #undef EDMA3_DEBUG2 j1 E+ u' v% j1 V8 t
  42. /*#define EDMA3_DEBUG*/* E8 c( R$ M8 [5 r

  43. ! D, Q+ f; C3 W
  44. #ifdef EDMA3_DEBUG
    / b' {) ~6 q# U5 k# |8 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# K' A8 w$ G0 D2 g/ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" c4 u: Z" P! q" O" k) J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  V  K7 f8 k$ D$ u$ N! X
  48. #else7 A0 i7 b* y& R2 i$ o( v
  49. #define DMA_PRINTK( x... )
    6 G% _" m% {  U% q$ n" H
  50. #define DMA_FN_IN
    6 a" D/ L  R! O, ~" {
  51. #define DMA_FN_OUT5 P; U) S; ~8 q: R# j. O; _" X! c- d
  52. #endif: V8 x, y" Z3 ?7 X3 N1 w6 u8 l9 d

  53. + x; {8 a& i" [2 N: n  H, ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 N0 b, V+ ?8 \# F0 C% {
  55. #define STATIC_SHIFT                3  d9 u/ T% D0 F6 I0 }
  56. #define TCINTEN_SHIFT               20
    1 G: @* N/ j% P7 k1 s
  57. #define ITCINTEN_SHIFT              21
    , t8 k2 V( C' A  G8 u4 ]$ ~
  58. #define TCCHEN_SHIFT                22  _2 ~$ k1 v# _- [
  59. #define ITCCHEN_SHIFT               23. X* ~( f6 c; s. J' l

  60. " U  E3 [  e3 u9 Y
  61. static volatile int irqraised1 = 0;; |. Q- _; _) ?: P& }. y' }
  62. static volatile int irqraised2 = 0;
    , U4 o- F* [% P8 h
  63. ' b9 v/ q0 q) h5 ]$ Y* m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 a) R& ?5 w  O3 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% v1 O6 g0 L% B+ o( {$ p$ |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; \$ L5 t. D' i
  67. 9 `  w& R, F3 A, V% V7 U4 s
  68. dma_addr_t dmaphyssrc1 = 0;
    / ^$ |; h9 f4 M' N1 i
  69. dma_addr_t dmaphyssrc2 = 0;
    6 J! \$ u* T2 f1 c; h! Y9 s; F
  70. dma_addr_t dmaphysdest1 = 0;, H+ j5 X5 x; d1 p
  71. dma_addr_t dmaphysdest2 = 0;
    * J* v" Z; G( Q" i- ~# B
  72. : T: u6 p- J0 P
  73. char *dmabufsrc1 = NULL;8 R9 @& A& _. i9 a
  74. char *dmabufsrc2 = NULL;
    " b% D5 @  b! I- F# E3 {; ?2 K
  75. char *dmabufdest1 = NULL;
      m# q7 o; X5 V: n
  76. char *dmabufdest2 = NULL;2 W7 k1 w. d5 Z. j9 h

  77. + l0 k! |; m/ A$ _, S+ r1 }- G
  78. static int acnt = 512;
    ) V, o6 S$ t0 s$ }! z; j7 @
  79. static int bcnt = 8;* T3 v5 u1 Z' }! n
  80. static int ccnt = 8;
    0 Z3 w0 a" Z( n, ~; X* Z- f

  81. : R% Y, N, I- `( q7 H
  82. module_param(acnt, int, S_IRUGO);
    3 y1 z: m4 a/ W7 s1 C3 {
  83. module_param(bcnt, int, S_IRUGO);
    " C. O1 t! R2 z2 `5 q: C, N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  c4 \2 l% ~  P8 m: @
( F) V: `7 H4 ?5 T+ U9 G  B& C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 E& c  h+ l% p; i& k' }arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 G' y- o# F% u$ x& p: E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& S- k) {0 G" [) E
6 N; q: l7 G# x2 z
& T4 |7 o( r7 L* L) L% }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-13 06:10 , Processed in 0.043926 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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