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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ c7 @$ L: o- z! I: s, r0 o0 l
  1. [code]EDMA sample test application
    0 |6 s1 S) W2 M0 Q7 ]
  2. /*# s1 @5 t# j' t0 D6 A0 q
  3. * edma_test.c; L+ r- e" h! [2 U
  4. *
    % \$ h* V" x  X
  5. * brief  EDMA3 Test Application
    4 L* t6 h; \4 i. X
  6. *' H- |' g* o2 S$ O
  7. *   This file contains EDMA3 Test code.8 f; p, Z5 y& a! k; N/ q
  8. *
    ; b! c; D+ F9 L/ d0 g2 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . q- F3 j9 q9 c# m) H3 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 c* g3 |* o' W) F% J
  11. *         TO CHANGE.
    " N' n+ u6 z+ U$ E1 G2 ~( ?
  12. *
    . v1 K+ r5 e& h& R4 ^4 i* |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( M4 `8 s2 I% i* Q' [9 E3 C
  14. *
    9 j! P& }  ]0 p
  15. * This program is free software; you can redistribute it and/or
    0 H* H& @9 }5 k; F" i) Q
  16. * modify it under the terms of the GNU General Public License as5 C* L/ `4 G9 @- c+ ~5 r
  17. * published by the Free Software Foundation version 2.
    % R& z) Y1 ~0 U% o2 }! C! c
  18. *
    & d; A" z% \$ V+ r, o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 @: j# x/ {# b- {& f+ \
  20. * kind, whether express or implied; without even the implied warranty
    0 V# q& ]( Z" _  c" R0 z5 {" a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 k1 W, ~/ [( T7 K
  22. * GNU General Public License for more details.
      t, H% ~. W& C; i& ~
  23. */
    1 L* Y% n- b% a( t

  24. + n2 r: b6 _+ u4 z4 ?% y1 P
  25. #include <linux/module.h>
    ) b& [' l$ o' S$ x8 ~" d
  26. #include <linux/init.h>
    ! T: ^. K4 {' t) Y6 G2 N
  27. #include <linux/errno.h>
    7 r7 h* U" [. ]( s' V' y
  28. #include <linux/types.h>) y% Q2 R5 I) R, A3 d6 |
  29. #include <linux/interrupt.h>4 a5 l, `# j  ^4 e6 a0 X
  30. #include <asm/io.h>5 a' i8 i% \, ~. \
  31. #include <linux/moduleparam.h>
    . t# x' E% U; P9 Z, o
  32. #include <linux/sysctl.h>0 ~/ |( s" E7 }( m( o7 }; o
  33. #include <linux/mm.h>
    , V6 Q3 L. b* k# ~" {- h2 \: Z
  34. #include <linux/dma-mapping.h>( }0 E2 n( @, v) d6 F) i  d
  35. 6 Q! m9 F8 U4 x, C
  36. #include <mach/memory.h>/ h4 b2 b5 L/ B5 g
  37. #include <mach/hardware.h>
    / |7 B+ k' c$ j- N% W" p. L/ I
  38. #include <mach/irqs.h>
    : a/ U! X" ~# L5 m
  39. #include <asm/hardware/edma.h>
    ) s$ ]) k2 |+ k0 e. z% y# g" k6 G

  40. 9 _4 u$ e; ]- Y1 r+ E" N8 L1 `
  41. #undef EDMA3_DEBUG7 N4 f  g; R6 C# p/ U
  42. /*#define EDMA3_DEBUG*/
    7 k, U. S9 Q0 c1 @0 l+ i( u
  43. * h2 ~' u" @. W& W* }3 H$ `7 J* r
  44. #ifdef EDMA3_DEBUG1 \2 P! {# e  K% l) @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# A+ I+ v- n! F' [+ ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ I6 a- j& a7 f  ~5 r) V& L* `, w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & E+ S$ X9 D; d2 z
  48. #else) `1 T- ^. F8 @/ v* f5 l% h" _
  49. #define DMA_PRINTK( x... )# N# j8 v3 `9 g% \: v+ J. ^" B. T
  50. #define DMA_FN_IN, m. Q* P  V9 |* o% q. E0 e
  51. #define DMA_FN_OUT  k- P( G5 _. w7 E7 q
  52. #endif" i2 H2 @! e6 ~2 N9 \' E2 J

  53. 2 f, j' G  a/ J/ S! D7 N! q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ o/ z# U9 x8 k7 |9 _( N' y( z
  55. #define STATIC_SHIFT                3
    6 S4 i# h2 R: @' w; V- i  y+ g! N& Y6 Q6 j
  56. #define TCINTEN_SHIFT               20
    . Q# ]& O% A2 \+ e; \& `
  57. #define ITCINTEN_SHIFT              212 P2 ^5 h+ y# [, S5 t
  58. #define TCCHEN_SHIFT                22
    % x5 e* W7 e' u2 p$ C' H
  59. #define ITCCHEN_SHIFT               235 u* Y# y7 @( [8 F' U

  60. 3 c- L, `4 O) c, u
  61. static volatile int irqraised1 = 0;; ]1 U+ w) y# g" @( L" W. c
  62. static volatile int irqraised2 = 0;2 S' \" @; \! E) E0 D" c! {
  63. & N3 C' d: y' y7 d7 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ]; r' g  G2 s4 B  c/ @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " m+ g/ `. J$ ]+ o6 h* J' f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 A: q7 a9 f  f9 m( W
  67. $ I5 A% y3 k9 S4 [, n& c' t; K! q; _
  68. dma_addr_t dmaphyssrc1 = 0;! \3 K% [3 o+ M+ N/ p0 ]8 y
  69. dma_addr_t dmaphyssrc2 = 0;
    , n; [, Y$ b/ ~) L! T, I! r
  70. dma_addr_t dmaphysdest1 = 0;! b0 N# b5 G; `* ]8 q9 w5 z
  71. dma_addr_t dmaphysdest2 = 0;
    5 E# @4 `. y9 b' Q& S% A* \
  72. * e( F$ X2 T0 b- d
  73. char *dmabufsrc1 = NULL;, W8 ?1 ^& a. n+ ?' [. ~
  74. char *dmabufsrc2 = NULL;$ }4 a$ i, n( r. R6 l; z
  75. char *dmabufdest1 = NULL;7 u8 t- H! H% @/ T
  76. char *dmabufdest2 = NULL;
    5 h! x0 G, {5 ^( Y
  77. ' E& c9 j1 S" z. j- V. P
  78. static int acnt = 512;6 f2 U1 [* V8 `: b5 {
  79. static int bcnt = 8;
    6 K/ O  \* M, k1 m
  80. static int ccnt = 8;
    + q1 a: ]; @- h" w7 [3 i
  81. . N' e7 _( a3 Y' b
  82. module_param(acnt, int, S_IRUGO);
    : f! A! j4 C/ C# _$ o3 A
  83. module_param(bcnt, int, S_IRUGO);
    ( X$ r; z6 P3 m, ?7 P: E: X& k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: {  l7 H) F3 ?, ]* G4 l( S4 _$ a/ `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! a6 r$ Y" @4 P- w; Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 \+ ~; L; ?, v; e- Q$ Z7 P3 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* c$ w9 n8 K: ]: ^, i! k! X3 I9 ^+ p! x

# ^2 c6 p+ r" Q3 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 21:22 , Processed in 0.040255 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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