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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' B9 U9 i+ q" p) M8 O
  1. [code]EDMA sample test application
    3 D) G6 k# w2 k: m/ ~
  2. /*
    1 u) L% I0 L8 N( D. q4 |- V
  3. * edma_test.c2 ~& L# }" l7 W# \+ A3 ~8 r0 `% j
  4. *
    4 |: O, a4 B& s3 X: R# S( U0 D
  5. * brief  EDMA3 Test Application, s& `# J3 I2 C, |$ Y
  6. *
    ; Y) x9 t- |. R/ `# P5 V7 u
  7. *   This file contains EDMA3 Test code.6 A4 g1 v3 ^2 {; G: U0 J
  8. *0 ~3 z1 N9 B1 H; R" m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# e5 w) R  K3 Z. V, U, k1 R3 p5 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 K  Z  J2 S  g
  11. *         TO CHANGE.
    * U+ x6 `7 L7 s$ R( L
  12. *! X4 ]# @! b! b6 i- U. g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Z7 w; D& _7 m4 L, f: r
  14. *
    $ x+ z! H4 q9 ?4 W7 P# G
  15. * This program is free software; you can redistribute it and/or
    8 }$ {& c7 {4 r
  16. * modify it under the terms of the GNU General Public License as
    7 }- ?+ {* d2 p0 p! P7 F
  17. * published by the Free Software Foundation version 2.
      k9 n, e: B9 [8 Z  \- X( H; W
  18. *  i$ o& B. m$ v, Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & `1 Z, F6 I/ z3 k+ N2 p. A
  20. * kind, whether express or implied; without even the implied warranty
    7 G  g$ @5 j+ p! |( @  Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : v! ]: O4 u1 m5 y3 k: l2 u' L( V( E
  22. * GNU General Public License for more details.
    % X  m+ o6 ?. {% g5 {& w+ k
  23. */* f  X; D; `; r& e" V

  24. * ^+ H1 i2 H# X, e( i
  25. #include <linux/module.h>( i6 e/ j  M1 ]. I
  26. #include <linux/init.h>
    ; h8 E# C; J( w. `  f
  27. #include <linux/errno.h>
    ) n  V3 g6 s7 `0 j  l' z* B& h
  28. #include <linux/types.h>
    ) y1 m$ S5 d9 r: S! x4 B
  29. #include <linux/interrupt.h>8 X# H' [$ t9 y0 R
  30. #include <asm/io.h>
    # {; b3 U( M0 b! i7 `
  31. #include <linux/moduleparam.h>
      f$ q, T4 n4 P9 P; v
  32. #include <linux/sysctl.h>
    , G3 x3 p! v# d8 L; y
  33. #include <linux/mm.h>
    $ [5 X+ Y, n& {( i& s- |, `
  34. #include <linux/dma-mapping.h>
    8 {# `: Q$ k. l
  35. ( J& \$ \5 E5 d8 `* _! I7 x
  36. #include <mach/memory.h>
    ; W( z3 B( U7 B7 v
  37. #include <mach/hardware.h>
    , j0 B& L" W2 ^
  38. #include <mach/irqs.h>/ O1 r" ]0 @% t& o
  39. #include <asm/hardware/edma.h>
    . @2 g' `3 y4 u9 `$ b
  40. ) h8 @" W, q: d! }
  41. #undef EDMA3_DEBUG
    ' O7 _* E, h: K( m- c+ n
  42. /*#define EDMA3_DEBUG*/$ i9 f0 r* T* H/ F! d7 B0 g

  43. + R5 l* `, q! x: ]( ?1 o% E
  44. #ifdef EDMA3_DEBUG
    5 U: {+ p" B/ u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 v/ B. M1 a' `$ E; L5 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- z( h" B2 Q# s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). T# O: Y/ M, l0 i% F! N7 i
  48. #else, Q9 w1 j) |: S& E& \* c( {' E' `
  49. #define DMA_PRINTK( x... )4 X; H5 }6 y+ F8 [3 S9 ~2 o
  50. #define DMA_FN_IN2 g, u9 ^8 L, j5 D! L1 l
  51. #define DMA_FN_OUT7 r- W% i( R1 o, l5 B
  52. #endif4 _4 _+ i8 X; f. k/ d9 s
  53. ) _9 ^8 Y4 F  F3 ^4 X# X3 n* c3 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( Q% d) t/ x7 K6 @7 R9 y: K  T
  55. #define STATIC_SHIFT                3  Q. d* }: I: f: ]1 q
  56. #define TCINTEN_SHIFT               20
    5 }7 M  s6 b; b6 r4 w: V
  57. #define ITCINTEN_SHIFT              216 O5 \' Q: Z5 J1 x# Q
  58. #define TCCHEN_SHIFT                22  }0 g8 |; O3 c; @
  59. #define ITCCHEN_SHIFT               23
    1 p7 c% B/ e( b" a0 {
  60. * i4 O# K2 o* ^9 [$ @
  61. static volatile int irqraised1 = 0;
    / a' i$ Z' @9 g( d+ T- @9 ?8 M
  62. static volatile int irqraised2 = 0;
    ) |0 C0 h$ a6 g  n% O

  63. # g4 S5 f9 N+ K7 p& W; H. t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 B9 M$ n8 g* p: C% B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& D- I( q/ G( h- e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M5 I2 A) ]/ P' k% j, [4 o

  67. 5 Z& c. s) X: n4 E
  68. dma_addr_t dmaphyssrc1 = 0;. R4 [% g. [4 d" t
  69. dma_addr_t dmaphyssrc2 = 0;
    / N$ z7 b+ d7 T" b
  70. dma_addr_t dmaphysdest1 = 0;: W: ]! {$ y* v& u& m8 e6 h
  71. dma_addr_t dmaphysdest2 = 0;1 I0 p) c( \/ T9 M/ ?7 m
  72. ' W: `3 m* l$ p/ X. f& V. k9 c  U# c
  73. char *dmabufsrc1 = NULL;
    * f; @+ {' D" x5 Z! x
  74. char *dmabufsrc2 = NULL;
    ) h/ f# ?: E! B9 Q5 M
  75. char *dmabufdest1 = NULL;1 v6 Q6 R. v( O
  76. char *dmabufdest2 = NULL;
    1 D. B5 x5 E" [7 c

  77. . H% k, [/ n. V/ _" e& Z% ^0 T
  78. static int acnt = 512;7 W. Q6 F$ G" ]) G8 o
  79. static int bcnt = 8;
    ; v, \- M) H9 a- E, o  s* V5 B
  80. static int ccnt = 8;
    8 ?6 J$ e' R2 u$ ]$ H& H  `

  81. ! [/ h3 {' g/ T, T7 ^( g
  82. module_param(acnt, int, S_IRUGO);
    ( V6 X: ]. l( W7 W* e& {
  83. module_param(bcnt, int, S_IRUGO);
    6 M7 c# a' K0 o( y* d+ ^. D. U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 X7 r! Y, v' o% G9 M+ |7 l* d+ J  h7 O
0 I. }* o: |, {2 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: W& b' Z$ ?& c% _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# q7 [- _3 {" F2 a6 k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) y$ O) j  d' E9 y7 U

& A3 d8 |$ a% E7 G4 f
0 E) E# L' T6 Z" U* X/ I8 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-29 01:14 , Processed in 0.044203 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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