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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 n$ P" F/ K* P% w- b
  1. [code]EDMA sample test application% H1 t2 q/ g3 u" I9 ]) g- k
  2. /*8 ^: ]) X. O/ q& M
  3. * edma_test.c! T3 ]- ]" z. ]% x
  4. *
    ( b6 b3 I( h2 U3 ~9 {$ W
  5. * brief  EDMA3 Test Application
    9 y1 l4 c+ f% a/ t1 ~
  6. *! ]$ ~5 i3 ~  i# F& k* b  n
  7. *   This file contains EDMA3 Test code.6 E3 U2 S) }0 b# [  H. i# w
  8. *7 u, t0 ^; J# D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: C% q1 j2 M$ [, F; L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      z7 Y" h8 w4 F/ Q9 {9 |
  11. *         TO CHANGE.
    $ ^0 q- f$ o; i- l
  12. *
    $ f! o  l0 p& `' i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 d' h4 x" S8 ?
  14. *- N* L$ x1 P0 N+ B7 S- S5 B/ S
  15. * This program is free software; you can redistribute it and/or9 m/ T3 f% r4 W0 p' h; B4 |1 k
  16. * modify it under the terms of the GNU General Public License as9 ^# H: C6 \' G# W
  17. * published by the Free Software Foundation version 2.' P) n. P3 J  P7 l# s. |  R
  18. *
    0 }9 Z3 y- Y3 r0 |! l7 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% S% N* v3 g/ k, k2 w! ?, g1 s& F
  20. * kind, whether express or implied; without even the implied warranty( ]/ B" K$ _  A" D! h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 {4 p: d' Q/ b" ^
  22. * GNU General Public License for more details.6 j- q7 c9 G, `
  23. */2 \: o& y2 T$ f) g9 r

  24. + s% d1 T& y& C6 d7 K4 \
  25. #include <linux/module.h>& T7 n2 D3 M) ]6 x- R& O
  26. #include <linux/init.h>
    0 y8 m9 c5 n0 d- g
  27. #include <linux/errno.h>0 m5 P& u7 L* @
  28. #include <linux/types.h>
    2 _- x  [, d' N" t
  29. #include <linux/interrupt.h>
    : V, t; A1 _: k: ^5 x/ M
  30. #include <asm/io.h>
    ; V  d5 H  W$ W  ?
  31. #include <linux/moduleparam.h>+ j0 A, j/ i& L# a+ |( X
  32. #include <linux/sysctl.h>" l& _  B) K0 }9 T3 g5 z+ b$ u' l7 X
  33. #include <linux/mm.h># t# _* @, W$ [2 F* f( u2 c
  34. #include <linux/dma-mapping.h>
    2 R- h1 L) @+ n! U; I# Q

  35. 8 D# P0 A& c8 m' y  O8 _) z4 p
  36. #include <mach/memory.h>' n1 s, i7 b- d
  37. #include <mach/hardware.h>. F  W8 q% y' J) {
  38. #include <mach/irqs.h>- `5 s" C) {- G- S' z1 u
  39. #include <asm/hardware/edma.h>
    ' M& n- p5 i/ O- {. K. a
  40. 8 i3 @# Y* C# c9 U
  41. #undef EDMA3_DEBUG: H' N  C( [8 a" y# d+ N
  42. /*#define EDMA3_DEBUG*/
    $ o( R* M7 f( L/ V, R

  43. 0 L/ D% [; a( G4 _" T2 T/ b% U
  44. #ifdef EDMA3_DEBUG
    . [* x: k; c. p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 {. H0 P9 G: j) a4 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' X/ T  [- P) n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 b9 A; u, `5 _9 ^) J+ l5 c' c
  48. #else
    * A) H  i$ J7 G) S  H7 m6 H
  49. #define DMA_PRINTK( x... )+ C) @2 l, k9 h4 D* E  F
  50. #define DMA_FN_IN
    0 c6 s9 J# c4 T; M7 A( u/ C6 L2 M
  51. #define DMA_FN_OUT
    % |# [6 S2 Y) w! P
  52. #endif
      F# F3 ?* i/ m9 K

  53. $ U, [4 N, @) y- t% \0 T' i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " W- J' y( ~! J6 S; Y5 Z- `
  55. #define STATIC_SHIFT                3
    : \: t0 e' n) s7 J0 Q  r: S
  56. #define TCINTEN_SHIFT               20# W3 I- {( Z8 P5 \' Q7 O, \
  57. #define ITCINTEN_SHIFT              21
    6 E7 S8 M6 [. }# n9 ^
  58. #define TCCHEN_SHIFT                22, Z; e0 o9 j4 a' r7 i$ K( w* v# a7 x- ^
  59. #define ITCCHEN_SHIFT               23
    ( q$ [$ z. q5 J3 i; F

  60. 0 _! [" @# f; C$ k8 J2 c; @. S
  61. static volatile int irqraised1 = 0;6 p& v9 t1 t( e5 e! f( E. J
  62. static volatile int irqraised2 = 0;9 d# C" O* E: D/ \$ x, J, [

  63. % q/ E5 e- L$ h) `3 ~$ b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " I3 B  _% K% W' U9 Q1 m* P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 M# @4 m) i1 @3 Q9 a' S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 x) _; g6 [/ j/ F. b5 {

  67. 6 W$ C. E. v& u! D' ]
  68. dma_addr_t dmaphyssrc1 = 0;$ z8 }# U. p4 k& n. v# z
  69. dma_addr_t dmaphyssrc2 = 0;
    , C: `: A' i2 l1 e
  70. dma_addr_t dmaphysdest1 = 0;& r6 d' g* d; M- t5 W: i" T
  71. dma_addr_t dmaphysdest2 = 0;4 F8 n! o, \  `0 m
  72. : k: J. f6 o( d  a2 T
  73. char *dmabufsrc1 = NULL;0 y" v5 U0 _4 S' N6 @$ B
  74. char *dmabufsrc2 = NULL;1 m/ `& w0 U* U& H  @. L
  75. char *dmabufdest1 = NULL;9 j5 b' J2 b4 Y7 J* w2 B
  76. char *dmabufdest2 = NULL;+ ^* V7 q6 W* F: q

  77. ( ], w1 T& g( ~" g4 q
  78. static int acnt = 512;% N( l8 y1 ]7 b0 O- T, e( t1 q
  79. static int bcnt = 8;
    / G& {! z% F  m" e; D/ O) _; }4 r
  80. static int ccnt = 8;
    + V* ^. a$ V8 ]+ Z, c5 Z

  81. ! k4 f9 Y3 ^' ?2 z
  82. module_param(acnt, int, S_IRUGO);
    6 G6 E& v, g: J3 U; H& \# K; g
  83. module_param(bcnt, int, S_IRUGO);
    ) G8 R- ^7 M( n' ]: H: u7 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ U" H$ a  w' @) J: i2 Y) b* F4 q

+ P# S9 D0 ~# n& O: V4 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, P  s% C2 p. F1 n6 J( b0 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- O# Y7 v& F/ F# n( f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) `4 Y8 r) D2 S9 \0 E$ V+ t& R: l  E; T1 P$ g; }0 E% m: E
/ W& d# D- a7 P( N4 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 21:03 , Processed in 0.040469 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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