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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) q$ B. X: O* \$ A3 z4 D# s8 D
  1. [code]EDMA sample test application
    " V" v% F4 K! T# d1 r/ B9 M0 Z
  2. /*4 w; v3 W# Y; ~% a8 U2 K3 M
  3. * edma_test.c
    $ G8 }& Y  T+ K! H) F
  4. *
    3 y8 n3 x/ C! ]2 c  K
  5. * brief  EDMA3 Test Application7 |3 a! ~9 Y2 ?6 p7 G5 o
  6. *
    ( i+ y' ]  E# \$ n
  7. *   This file contains EDMA3 Test code.6 U' S7 i5 e6 {0 r4 J
  8. *
    6 T) C. w/ \- [; A4 ]* T8 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - N4 z! ]# w" H1 t, ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * S# _) G0 D: o, Y* Q4 w8 U# t
  11. *         TO CHANGE.2 U7 j5 K# q, A; Q
  12. *
    + t7 N& E2 _& C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ S8 x3 f. u* Y5 F9 r1 G! B
  14. *
    . \; W( j6 P* u, p; f% m( S8 |
  15. * This program is free software; you can redistribute it and/or
    5 z, S, ?; I0 F  p& y# G! u
  16. * modify it under the terms of the GNU General Public License as
    5 k2 x( ^3 I) B7 M: @. Y- P
  17. * published by the Free Software Foundation version 2., Y2 s! u! g4 s: j4 F# ?) e5 h% a: y
  18. *
      z% }6 A0 D  k7 P- b" p# q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; J# U0 ~$ J% g
  20. * kind, whether express or implied; without even the implied warranty
    2 s7 N6 y- @9 {2 P" m/ c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , k4 D* L1 y' b, c0 m0 G
  22. * GNU General Public License for more details.
    5 q- j% Q9 i! b4 y# T: I5 w3 R: I
  23. */; {3 _% n% o8 {: l
  24. 2 I" Q1 z; ~! p  ?. G' a7 m
  25. #include <linux/module.h>
    ' {* P* I* H7 Z+ j! @  g2 l
  26. #include <linux/init.h># }- }" k# d2 D; y5 _; m& \
  27. #include <linux/errno.h>5 F6 z& r" G; d" C$ ^- a$ i# {
  28. #include <linux/types.h>
    . |; A5 S9 _: G6 y5 M* E3 z
  29. #include <linux/interrupt.h>
    ! e" M" L4 ?0 W) Y6 m
  30. #include <asm/io.h>
    ; G- N2 f2 ^2 k+ ^( \% T
  31. #include <linux/moduleparam.h>" {! R- i% U9 s9 l+ p
  32. #include <linux/sysctl.h>; A0 {$ T' O  r8 w7 }& h
  33. #include <linux/mm.h>  u3 o3 d# ~) K. z+ d
  34. #include <linux/dma-mapping.h>3 D4 ]/ g1 z) b
  35. - `+ \& P" ~2 ]' k0 H
  36. #include <mach/memory.h>
    1 F/ \$ c/ U5 o8 k
  37. #include <mach/hardware.h>
    # S' K( C1 l" @
  38. #include <mach/irqs.h>
    8 y$ H' F2 ]# J; q# y6 r
  39. #include <asm/hardware/edma.h>
    0 Z$ j/ K0 C, k0 p3 J2 \1 d* _
  40. 5 G6 B$ J( g+ P& j) B4 v4 }
  41. #undef EDMA3_DEBUG
    & r$ E0 U1 L& a0 d8 s8 D- i" B
  42. /*#define EDMA3_DEBUG*/
    " v7 D7 S  Y+ j' @4 ?5 a4 R
  43. 2 U* v4 P3 Q* |- S' r& o% W
  44. #ifdef EDMA3_DEBUG
    ) q7 _0 m% S& J# n' ~, e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + M! g. J6 L+ n( z) k" i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 {0 e5 n# T/ ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 b8 `  y8 t4 t; ~4 D( k
  48. #else
    , Y  s; f0 t6 E3 O: B4 t6 i
  49. #define DMA_PRINTK( x... )
    : n5 \! o' u- x$ u
  50. #define DMA_FN_IN' M1 [; y2 @: \' j
  51. #define DMA_FN_OUT# T0 q4 D# P# V  X, z8 J
  52. #endif5 x( i8 K: u5 o+ _* Y

  53. : q; @4 d3 U  K" {3 c6 I4 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' p' D8 W/ k* c% C
  55. #define STATIC_SHIFT                3
    7 s# H/ X* Y. E# ?* a. q8 @( H$ @
  56. #define TCINTEN_SHIFT               205 L  m% ^; e9 i8 P5 b9 |
  57. #define ITCINTEN_SHIFT              212 V3 R7 g" _5 k1 c5 }
  58. #define TCCHEN_SHIFT                221 N- G& U$ `6 |+ n: Y3 X
  59. #define ITCCHEN_SHIFT               236 k/ ~/ l( t5 D% m$ K# q

  60. 3 V0 r5 x. a6 `. O: e% |/ A$ t
  61. static volatile int irqraised1 = 0;
    & r6 ^4 O' h* V8 a
  62. static volatile int irqraised2 = 0;
    3 R5 f5 {- N  y7 w5 K+ s, ]

  63. ; Z7 K% n, y2 h& s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' k$ l# o! g, M3 m& W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; N" i# C9 P  L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# E0 j) E$ E/ k
  67. 0 G, K1 f2 S7 @! A: x  A8 j. B
  68. dma_addr_t dmaphyssrc1 = 0;
    0 e3 L6 y& W! V
  69. dma_addr_t dmaphyssrc2 = 0;8 z% g$ n9 ]+ S9 E+ R- E$ h
  70. dma_addr_t dmaphysdest1 = 0;* I  z+ f1 j( C
  71. dma_addr_t dmaphysdest2 = 0;
    + k3 J: \  K  C: h0 k. S6 W- x

  72. 6 I# }% B! I! Z/ k. K
  73. char *dmabufsrc1 = NULL;
    $ I* L8 J6 }! R9 f
  74. char *dmabufsrc2 = NULL;5 [2 V* R* I! p( `0 G' H0 S
  75. char *dmabufdest1 = NULL;
    1 x0 S3 |( v" }' Y& k7 o5 X
  76. char *dmabufdest2 = NULL;
    / E' ~9 d+ @" Z" d- c5 Z+ [, n4 U
  77. 4 [. e- N: j# A7 j6 B4 }4 e- r
  78. static int acnt = 512;+ j7 a2 J- e  T0 z! J' G0 _' v2 |
  79. static int bcnt = 8;
    # B1 V! M5 r; G1 U
  80. static int ccnt = 8;1 G* L* I6 J! z! e1 S
  81. " w+ a* E/ Y1 j% r+ q
  82. module_param(acnt, int, S_IRUGO);
    3 u( @" _0 ?% w7 D
  83. module_param(bcnt, int, S_IRUGO);4 D& g- [" j( B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, L" z- s0 Z6 a) M
& t5 a' A2 L: L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ?7 r; _2 G% [' \7 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' D1 W  T. Y; K( I1 k! V% t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ z% z5 |7 V7 P; }. ~& A: z0 k9 e+ N) A/ v# N8 D! U; r$ ?3 h

, G  ?3 h( ^2 k* c: f0 I& {- H/ M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 19:24 , Processed in 0.041998 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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