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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 s# V! K4 Z' S- w2 _& _, ?6 ^+ w
  1. [code]EDMA sample test application
    ' s1 V. x* H) Y$ m
  2. /*
    4 L  y8 b- U1 A! B
  3. * edma_test.c' H, @2 \- O2 L2 n' e7 c
  4. *6 r0 c. F1 ]3 V4 W/ w
  5. * brief  EDMA3 Test Application
    2 r! H$ C$ Y0 a) `
  6. *2 V& b, D5 r( I; I# Z1 `! z
  7. *   This file contains EDMA3 Test code.& \/ ~1 p( A0 h7 A
  8. *
    1 z. a3 F4 C( B7 d4 E0 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 G6 z9 {8 M* [2 G. c2 \7 c7 m) U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      S6 O% r$ y0 I  C# `. w
  11. *         TO CHANGE.! V( ~' S% X; h6 K- p* p
  12. *
    , v& T) ~/ j- |3 T$ x# c1 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 f; ^5 i( S) S! g, o6 ~
  14. ** _  N' z  J+ n* H
  15. * This program is free software; you can redistribute it and/or6 H+ P3 _& X7 X8 g
  16. * modify it under the terms of the GNU General Public License as  F- H0 ]9 ]$ a+ A+ M6 h
  17. * published by the Free Software Foundation version 2.& G8 }$ t) F8 G( H0 U2 P
  18. *! @( u; _! Z" ?/ ^7 U5 p- t, s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& q2 m& Z# {/ j* D. x3 L
  20. * kind, whether express or implied; without even the implied warranty% B0 u2 a& \4 S- e0 }, i; m1 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 k, O7 B) O4 E4 {% g
  22. * GNU General Public License for more details.
    ' `  ^8 x6 r' s2 }8 W. w5 N9 X0 r
  23. */) O# B" {# d7 R. r* Z- ]" Q
  24. % e5 G; E' P' G7 g, k& Z" u
  25. #include <linux/module.h>0 U: [6 }. X; g! h
  26. #include <linux/init.h>$ U  X) e, v3 X+ f
  27. #include <linux/errno.h>2 W" a7 f. j8 L" X
  28. #include <linux/types.h>1 G9 M( k9 p# z* L. B4 a
  29. #include <linux/interrupt.h>
    3 {9 x0 h4 i3 O! o; j9 |! N( m1 f9 R8 H
  30. #include <asm/io.h>" W( {! `3 }* U9 D; d
  31. #include <linux/moduleparam.h>% H- {7 N/ B: L% Y: Q! B! Z4 b
  32. #include <linux/sysctl.h>4 h1 X# i9 k/ n. o, J$ W
  33. #include <linux/mm.h>8 M" h: ~* O; ^5 S6 C3 l
  34. #include <linux/dma-mapping.h>0 J3 S! j: r1 _2 k! e+ n' {6 @
  35. 9 E/ q: H/ C2 L* T+ k1 A% J2 @
  36. #include <mach/memory.h>) r& U: E/ c( y5 p% T2 |  x; @, e2 E5 y
  37. #include <mach/hardware.h>
    2 r5 K( _8 w$ I2 n+ a
  38. #include <mach/irqs.h>
    2 W. }* j) Y& N" A& }# H" X* s! r
  39. #include <asm/hardware/edma.h>8 P$ h9 S2 q* G
  40. 4 p, u! I0 ^  `' I! ?
  41. #undef EDMA3_DEBUG4 I2 I. H% o8 H
  42. /*#define EDMA3_DEBUG*/- c2 `2 ?4 c( m
  43. & q8 s& T$ s% p2 D0 I7 x
  44. #ifdef EDMA3_DEBUG$ i3 B% {7 O' S' b2 @0 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). E2 n, w' T  b- ~' l6 a  B* F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " B& Y- c1 x2 ]/ l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  o, B5 A/ c% F5 |
  48. #else8 T$ i) I- V; J# ^9 @
  49. #define DMA_PRINTK( x... )1 N& a8 I; Y) b# @) ^1 R- o2 a
  50. #define DMA_FN_IN) p! F) O/ y; X8 X
  51. #define DMA_FN_OUT
    ) e7 B$ E% Z7 F
  52. #endif
    + n/ l( t: a7 V$ J2 y7 D

  53. 2 ]. |" L( u- n7 Z3 O2 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , X, R6 Q( E- c, n% B
  55. #define STATIC_SHIFT                3+ T; {, `' L( a5 g# H& `6 b
  56. #define TCINTEN_SHIFT               20
    4 S! S% t  r; D- a6 J$ j" g
  57. #define ITCINTEN_SHIFT              213 y' w8 |; q$ c$ ~' K. P* x
  58. #define TCCHEN_SHIFT                22
    & d5 m6 Y+ D* G
  59. #define ITCCHEN_SHIFT               234 y7 X+ D: _# E9 U7 ]

  60.   B, O4 J, Z$ g: l1 x
  61. static volatile int irqraised1 = 0;
    0 C3 @1 i+ b& s/ w3 C
  62. static volatile int irqraised2 = 0;
    " s" h5 K- K& z% y

  63. : @# i+ w' F7 \; u" U+ `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( @. w) Z' `' K" S7 F  E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ^6 A4 g! c. c, L' I/ x! o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ b4 ?% U* n' m1 C; N2 l% ^

  67. 9 V3 d1 n- ?( M
  68. dma_addr_t dmaphyssrc1 = 0;3 Z, Y# h" k" `
  69. dma_addr_t dmaphyssrc2 = 0;
    1 S3 z' r( H" c* s. W, ?
  70. dma_addr_t dmaphysdest1 = 0;
    3 o" i; v# O) P! F
  71. dma_addr_t dmaphysdest2 = 0;$ t# s% Z+ O/ |$ E, o5 o9 ~

  72. 6 K* l7 z0 @5 a' o
  73. char *dmabufsrc1 = NULL;
    / i+ J$ Q/ C# w; h
  74. char *dmabufsrc2 = NULL;! }& Z, Z  I8 b
  75. char *dmabufdest1 = NULL;0 Y% Z" k/ D/ z+ a/ L3 h+ J
  76. char *dmabufdest2 = NULL;
    / `9 f) q% Z) ?1 n$ V" V2 e
  77. : A' L3 c9 b% x7 |* |# y/ X
  78. static int acnt = 512;- U' ]. v$ Z8 m7 L
  79. static int bcnt = 8;
    # ~0 j! I) V0 G8 V7 ~
  80. static int ccnt = 8;
    7 `; j: V2 W0 `4 |2 K5 d

  81. % h$ h3 z) K/ d4 d) r& D
  82. module_param(acnt, int, S_IRUGO);
    1 Q5 i1 u+ |& v0 s3 L* Y0 _
  83. module_param(bcnt, int, S_IRUGO);
    ) [3 y2 T2 N& L4 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ u# y& b: [8 m/ [

5 z6 k1 C- t: v8 G" q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 @2 t. f8 l* j$ B' l3 `1 K# t! Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" c; H, {, D/ D! f+ x4 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# d& b1 ~2 {9 F" [. U& z0 z% N" k  Q1 U" S. W% U6 N% E
0 K- o$ a# X$ B7 E( F7 U: m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 20:56 , Processed in 0.040733 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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