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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W( J6 z8 v/ u3 f5 B- C
  1. [code]EDMA sample test application7 V' F4 F" W: W+ M+ K7 f# w
  2. /*. ^( X. J# R' s6 c3 H
  3. * edma_test.c
    5 j0 E; B$ f: o
  4. *2 _0 s0 }* F# k9 x9 z
  5. * brief  EDMA3 Test Application/ c; u! S* r/ a& \4 u; @
  6. *6 G6 i. I: o( T0 X2 E- U- h& ~
  7. *   This file contains EDMA3 Test code.
    8 h: z9 Q, V0 a+ c" _. M' N
  8. *
    : A/ W$ W4 {- L" O7 l4 U7 k3 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 y1 c! `9 X- {5 c# N+ y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 s+ o2 M" _! y  N$ r& u
  11. *         TO CHANGE.3 i4 N/ |+ A9 w1 `& j0 D
  12. *
    ) Q1 {; e& n5 e2 O# d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// K0 [  {3 V; }5 C
  14. *2 x4 T  _0 U$ A1 n. M. u
  15. * This program is free software; you can redistribute it and/or
    ' W% \5 Q7 |( o; G; k
  16. * modify it under the terms of the GNU General Public License as/ H3 o/ z* g0 Z! g0 b( S3 b6 @
  17. * published by the Free Software Foundation version 2.
    # i5 z, Z- U, s8 Q: q0 l+ c& u
  18. *( |  _6 B, O( z  J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( P% T& G5 c% d: ~% `& d
  20. * kind, whether express or implied; without even the implied warranty+ L. E. }( s8 Y; k+ f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ w" U- U  t$ O
  22. * GNU General Public License for more details.
    + C& l7 S9 E( j: h+ I- _1 L" I
  23. */2 o/ a! y5 C, Y4 R0 o$ O
  24. 4 N# s: [0 {9 R& b# |, C
  25. #include <linux/module.h>' C- Y# j: f1 r; o* \
  26. #include <linux/init.h>
    " w$ D1 a6 e3 \4 ]; F5 v
  27. #include <linux/errno.h>
    8 @. Z' r- Y$ c. X2 n# t  k% n! u
  28. #include <linux/types.h>
    ) Z& P) a$ l  @! \7 W* M( a; l
  29. #include <linux/interrupt.h>
    # I4 S4 q3 _8 @$ j# G, r
  30. #include <asm/io.h>
    : q! t6 t$ [5 n' P; d0 e
  31. #include <linux/moduleparam.h>
    / G1 L! Z4 G9 l& |- f( p
  32. #include <linux/sysctl.h>
    4 k9 }5 {1 G( Y& B% z+ t- p
  33. #include <linux/mm.h>: C6 K% }$ u* @6 |* M
  34. #include <linux/dma-mapping.h>
    : L$ I: Y$ p1 J7 K. q
  35. 6 y8 r3 a/ H* K- w! s
  36. #include <mach/memory.h>0 F! ?$ q- }) ~% e9 c
  37. #include <mach/hardware.h>' v8 U! f7 l+ r. L$ C
  38. #include <mach/irqs.h>
    ) e' B& \! V+ ?) Q5 W/ U( U
  39. #include <asm/hardware/edma.h>
    # b- g4 t6 B1 U: y; t; U' K

  40. # x+ c5 m0 x6 l2 _2 [' o4 ^6 R
  41. #undef EDMA3_DEBUG
    & o6 K, u/ j  O' ?. V- s
  42. /*#define EDMA3_DEBUG*/6 I2 p# g3 x% E4 \! E
  43. ) s* n/ ]) b+ t& Q$ A% @8 \# n
  44. #ifdef EDMA3_DEBUG
    ! }6 f" a: _# I* {3 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 Y8 w; h# H8 x5 U) A  ~9 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  n/ j, y7 n$ j; g) ~) r! [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Y: P! ~7 s7 E7 |1 A" t4 I. @' Z& n
  48. #else
    / ~3 T& O8 i0 Z
  49. #define DMA_PRINTK( x... )
    ' f- l! Z! ]! d6 [7 ~3 ~+ w2 O+ n8 E0 L; v
  50. #define DMA_FN_IN. l% ]3 c8 D" M' C8 x
  51. #define DMA_FN_OUT
      t9 F6 s& y7 |+ q$ T" u
  52. #endif
    ( _4 v7 m2 W( K; v* q( b' O

  53. 9 c+ h# t$ [0 k  ~$ P. o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* P9 s' _# F) w, `
  55. #define STATIC_SHIFT                3
    9 @( F' j8 ]- b; j8 a. d3 @' e
  56. #define TCINTEN_SHIFT               208 N& t# X5 g' I
  57. #define ITCINTEN_SHIFT              21
    3 s8 x) _, F$ {9 Q
  58. #define TCCHEN_SHIFT                220 J8 d' R1 r+ J% A6 W, j
  59. #define ITCCHEN_SHIFT               23+ w9 o2 u8 k' d  d
  60. # u7 y; p: C) e" W+ {
  61. static volatile int irqraised1 = 0;
    + T4 O) n; Q' l7 s* e4 h
  62. static volatile int irqraised2 = 0;
    + v! ~4 s, h# @% r! V  ~# y
  63. - t# k5 ]. p' l* I9 G  ?4 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 T9 Z. W2 E4 I' V$ M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* I$ m9 V) q; k3 ?2 X5 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# [9 u9 [; e4 N; l# L7 k

  67. : f2 a$ u6 [+ L/ p6 _, g( m7 @
  68. dma_addr_t dmaphyssrc1 = 0;
    & @* s! d  @0 v7 f8 V! f
  69. dma_addr_t dmaphyssrc2 = 0;" X! _$ R! r' U
  70. dma_addr_t dmaphysdest1 = 0;
    6 {/ d. i' |, U8 A1 ?! j3 M- K
  71. dma_addr_t dmaphysdest2 = 0;
    , L/ d( x3 v3 s- l2 a8 W2 b

  72. ! {; `* t; ]& O# \4 c
  73. char *dmabufsrc1 = NULL;
    : W% o5 V/ f) [0 g8 l# X
  74. char *dmabufsrc2 = NULL;4 A6 [% e0 |8 N2 H
  75. char *dmabufdest1 = NULL;, S- ?6 s6 J1 Y4 l& P* F& _/ F
  76. char *dmabufdest2 = NULL;1 n; }+ E; ^  v8 p
  77. $ ?+ \+ d# s) h' c+ q6 Q: ~
  78. static int acnt = 512;, ?# V  L6 A+ W6 L
  79. static int bcnt = 8;
    4 U4 F2 G+ X! r9 b
  80. static int ccnt = 8;
    " m" u7 s' H" Z. D1 a- `3 w- J

  81. 4 K9 W& Y2 Z0 M
  82. module_param(acnt, int, S_IRUGO);+ h0 [: W2 u# _6 d7 H, c* Z
  83. module_param(bcnt, int, S_IRUGO);
    9 J! x6 }7 k' ~4 a* J4 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 H. V. Q* ~2 j0 P$ Q& ]" i
0 a8 X% Y! n% m0 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: F4 ]# Z- N2 t7 _. @2 I) Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* W! @! R. ^9 F2 h, w: N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 |, [/ _- a7 d& w5 T

8 w2 }' F% r! w& r* q( s  ~3 |
3 E! Q8 n, \0 X8 Z$ q% t; u" r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 04:38 , Processed in 0.039103 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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