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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 m) V; D- ?  H% N3 _2 y% k) }& j2 A
  1. [code]EDMA sample test application
    ; h  r, V' S! N* n1 q9 e
  2. /*
    ! a3 a1 Q, T. I' h3 y1 b6 J1 _! i
  3. * edma_test.c
      G0 B2 @5 r5 G* K* Y, v6 I
  4. *
    ( H6 _) _# n# M
  5. * brief  EDMA3 Test Application
    2 g) t8 A& o$ J* \9 h# t( t
  6. *
    ! K& l- |. R  \5 X% [
  7. *   This file contains EDMA3 Test code.+ q2 M& q% s# \5 e. k
  8. *
    : ]9 ^  ]. S* z& ?! h7 I4 _1 |3 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; Y2 s' E% H6 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! D& }& ^. b5 x
  11. *         TO CHANGE.
    & [4 U  s" @* X, ^/ i
  12. *) ~% n7 a, f6 o. O5 z3 E0 |9 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; o+ _& v! \3 ]  ]; d$ I8 ]8 q
  14. *
    8 z8 G( J4 a1 _
  15. * This program is free software; you can redistribute it and/or
    ( J2 F. p6 j! P) y- K
  16. * modify it under the terms of the GNU General Public License as
    / F; F" {% M! n7 o
  17. * published by the Free Software Foundation version 2.
    + H, B9 o% u" I5 U( h/ @$ o6 X. V" P* _
  18. *4 d: }# R& }) ?1 o0 {* l+ Q+ c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! N) [  J  a6 `" M
  20. * kind, whether express or implied; without even the implied warranty
    6 X, I" |! h, e6 v: ]  a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( A: j! b. a( X1 f- [* N2 Z( ~
  22. * GNU General Public License for more details.
    ) W3 k! @6 K# G; h! A/ w
  23. */
    5 |& {# Y' `5 M/ b/ J0 t
  24.   P/ i# R; `( k1 p) k$ O! @" P
  25. #include <linux/module.h>; }6 v: z/ U5 u; J' N$ `
  26. #include <linux/init.h>$ _0 d! M' }/ k. ^& E3 j: ~1 ^0 ~
  27. #include <linux/errno.h>1 W6 K& O: I, {$ z  f- I2 v
  28. #include <linux/types.h>+ g3 M9 q! r, L$ @- _' F/ E/ g7 S
  29. #include <linux/interrupt.h>" e5 q7 r6 T7 C9 Z3 |; I
  30. #include <asm/io.h>
    2 X4 D/ ]" p9 |1 C
  31. #include <linux/moduleparam.h>& [; J$ r. a4 z. [# b$ ]
  32. #include <linux/sysctl.h># v) ~! n; a/ Z( i9 U& j' {& D2 {$ H( S
  33. #include <linux/mm.h>& p/ j" C3 o" I9 o
  34. #include <linux/dma-mapping.h>
    . ?  r+ H; p  i" n4 {; e2 Z

  35. # d$ Y' \+ u1 e; @
  36. #include <mach/memory.h>5 J# }( Y5 @( N* l- Y4 b) l
  37. #include <mach/hardware.h>
    7 z* Q8 O7 X' ]! g' h2 q7 Q
  38. #include <mach/irqs.h>
    . M& D/ U6 h7 n# {7 L7 ^5 b
  39. #include <asm/hardware/edma.h>
    9 E$ X9 b" c" S' T/ {2 L
  40. 8 m- J* \( g6 \6 X
  41. #undef EDMA3_DEBUG
    8 z1 ~# T* Z2 S7 B7 ?( ?% }. s
  42. /*#define EDMA3_DEBUG*/- J7 h3 I/ l) B- C( N

  43. 6 U4 V9 K% A5 N; _6 V3 A, U
  44. #ifdef EDMA3_DEBUG- y4 m1 t& t/ D" t) R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ w0 P! {7 ]( |0 Q: f. [* d7 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; f( E; J4 l9 ~/ C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 V7 p2 G, D4 G" h: a6 G, R, I
  48. #else
    % E2 S$ y% q, \5 J+ T6 y% l- z% F
  49. #define DMA_PRINTK( x... )
    ' |- {9 w' r+ A0 M9 l. L" D& y6 E
  50. #define DMA_FN_IN
    % T* \( q% T% q
  51. #define DMA_FN_OUT* E5 q- j8 L6 i5 J
  52. #endif
    4 s4 i1 f' V) R6 @

  53. 8 t3 }7 Y, C& Y' b2 a$ g0 Q# i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 d3 V; \- ~' s8 i
  55. #define STATIC_SHIFT                3
    4 U2 B( S0 V, d% t2 b- _& o( R1 c/ O
  56. #define TCINTEN_SHIFT               20
    : R# ?: J3 `6 G$ O4 t
  57. #define ITCINTEN_SHIFT              21( V. C7 u' a4 G0 r, m
  58. #define TCCHEN_SHIFT                22
    + N' }5 V4 y8 [9 h- _3 R) m* B
  59. #define ITCCHEN_SHIFT               23  ^3 p- s+ S+ K2 E0 t
  60. 1 a: a# }# u6 B+ l; \5 |
  61. static volatile int irqraised1 = 0;) i5 P0 w; ^, |' r( i$ ]
  62. static volatile int irqraised2 = 0;
    ! i, v0 N  N1 m

  63. 9 T( T. C+ T# E) W; a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. _1 L, V& K$ k  `  i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 x' X4 V. D  {1 j2 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % |3 H2 E2 l9 Y) y. L

  67. - _/ T7 y* M' V: M" ]0 a6 |$ h/ \
  68. dma_addr_t dmaphyssrc1 = 0;
    9 X8 r3 w: S- O/ @
  69. dma_addr_t dmaphyssrc2 = 0;
    8 t6 G% L  x2 R$ E# d4 M; t
  70. dma_addr_t dmaphysdest1 = 0;
    + L; Z$ z" A& M- l- E
  71. dma_addr_t dmaphysdest2 = 0;' q9 @, Z# E  K( i$ G5 [  d& T
  72. ; N  s; G1 `( _. f- a9 }" V: |
  73. char *dmabufsrc1 = NULL;" K) a6 ?# u8 l% h. U: f" R
  74. char *dmabufsrc2 = NULL;
    & d( O) b  p% n
  75. char *dmabufdest1 = NULL;
    1 \5 r% j0 }# F9 F7 ~8 Z6 V
  76. char *dmabufdest2 = NULL;) c1 E+ R7 o4 j: F/ A1 x" ?+ }: g* P
  77.   ^0 D0 W, q" R' h
  78. static int acnt = 512;
    8 B! ]6 h, R/ q; X2 R
  79. static int bcnt = 8;7 x1 Y& t! p7 K+ N/ x; m3 [
  80. static int ccnt = 8;
    3 D3 d5 ^7 v+ i" d2 f2 n5 S
  81. 9 e: F2 A6 ?1 l3 J- H- \6 l
  82. module_param(acnt, int, S_IRUGO);
    1 X3 [# L$ e: P& w! p" b
  83. module_param(bcnt, int, S_IRUGO);
    ) M. n1 Y; T7 M; X! ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ Q2 k  t& u1 E7 t
5 s' [8 j6 c  z' H/ D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ q/ P/ {3 j; L9 o5 ?5 U: _# t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% T6 O8 k* u- z1 ^! s: X3 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 Y' A% I+ k- Q1 v: O. l
" Q1 m8 D% N7 b0 P/ l, e; H% U/ f; Y/ k, p. y9 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-26 12:01 , Processed in 0.040875 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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