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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 L  M6 H) ]& B6 k/ Y! g& h
  1. [code]EDMA sample test application$ I$ U) \2 w. T2 I6 f( `8 A
  2. /** S1 w5 G" f. \4 O
  3. * edma_test.c
    $ o5 @+ c! H3 z
  4. *7 |- y% s7 u# [! X1 I% b! u' h
  5. * brief  EDMA3 Test Application/ B0 w3 p) H8 t: Q$ x
  6. *, K- k& V* s6 b3 \9 k; a, S5 X
  7. *   This file contains EDMA3 Test code.
    ; n1 k) G6 u2 {0 p! d. h6 \
  8. *. U0 i* C* c* X; I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & X- J% [5 u# C/ f/ P$ y4 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 N! z3 _/ H2 Y* O8 N! Y; N0 V5 K
  11. *         TO CHANGE.' d% n) \3 k/ e  D7 k, b  `
  12. *
    - @' v9 p' P/ j9 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' S( _/ Z/ k% J# \0 g
  14. *' D* j  ^& R, |5 C( q2 P6 D/ K: e
  15. * This program is free software; you can redistribute it and/or
    2 g8 C  v5 v; f' t
  16. * modify it under the terms of the GNU General Public License as' ]/ t% ]7 X3 m$ `
  17. * published by the Free Software Foundation version 2.
    4 L/ w- E/ h+ n! }( n) y
  18. *5 J& N2 r$ ]3 @* `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ }/ ]+ j! @" d  v5 R
  20. * kind, whether express or implied; without even the implied warranty+ C2 Y/ r* C8 [- c- U$ m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( a1 B. G4 ?4 S- k
  22. * GNU General Public License for more details.( g" p, o( x" M) _# m6 Z
  23. */! P/ u7 C" W: _  u* j$ ^
  24. 4 d8 ~0 Y4 f$ P3 V5 W/ X
  25. #include <linux/module.h>; V. J# M+ K6 B
  26. #include <linux/init.h>& ^9 B# D8 i$ k3 H* z& N2 v
  27. #include <linux/errno.h>5 U; a/ Y. J. Q8 X! I3 I1 K
  28. #include <linux/types.h>/ x7 ^. A% w; S8 _! o
  29. #include <linux/interrupt.h>( N4 z  D3 A( }  \2 X
  30. #include <asm/io.h>( ]+ {! j# Q/ @' S+ O: M
  31. #include <linux/moduleparam.h>; {/ J" D) l# j, Y7 Z
  32. #include <linux/sysctl.h>
    2 ]5 j. e0 S3 x! ], n: `& D
  33. #include <linux/mm.h>* U8 f( ?- U3 ^: m9 m3 K' b( @
  34. #include <linux/dma-mapping.h>/ D0 ^3 w. P6 ]/ _/ r# m' G

  35. 7 I/ l" m& v3 g' k3 f- l7 _1 ^" d
  36. #include <mach/memory.h>
    / c: q2 v$ g' u
  37. #include <mach/hardware.h>' `0 c! P, c, n' r  P) B. P0 @4 L3 w
  38. #include <mach/irqs.h>
    2 G/ p! x, h; s2 S# g& y
  39. #include <asm/hardware/edma.h>
    , b* r8 s! [* R) _8 m* w

  40. % t2 W+ ]) {0 X0 m9 g
  41. #undef EDMA3_DEBUG
    # a8 b  o1 k: F: a3 ]2 @
  42. /*#define EDMA3_DEBUG*/
    ' U( ^3 a+ e5 b$ P/ N- |
  43. : t+ y5 t0 n7 u, h; o/ e" o
  44. #ifdef EDMA3_DEBUG8 F' h+ U) f6 f0 L9 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ a# b1 W. o) Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 \$ g- d6 q& e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 L1 Y% p9 ^' t/ K8 `" O
  48. #else
    ; Y; s& _6 W( Y/ Z0 |
  49. #define DMA_PRINTK( x... )) i% }3 t; W0 K- c
  50. #define DMA_FN_IN+ f, x/ E- |0 @4 y$ H' Z2 ^
  51. #define DMA_FN_OUT7 c8 P: C7 X3 c3 v* _
  52. #endif* }, M% Q( O+ x, h4 j5 F3 t' z
  53. ) m8 t( Q5 O+ a  w" V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( q. e# `* H) n& {! a& M
  55. #define STATIC_SHIFT                3; \/ P* ?) {. w6 Q5 ~; k& L
  56. #define TCINTEN_SHIFT               20
    7 k/ D( h, s' ?3 q
  57. #define ITCINTEN_SHIFT              210 w# E  f* ~+ ]3 e
  58. #define TCCHEN_SHIFT                22
    " \7 V$ K( H& q3 ~0 H
  59. #define ITCCHEN_SHIFT               23
    , `, Y( p& L9 _6 t# c/ F2 t' V
  60. " R) \  L# O: {' [1 l, u7 A: h
  61. static volatile int irqraised1 = 0;
    8 j) u8 q% y6 I0 c5 }3 c
  62. static volatile int irqraised2 = 0;2 d) i% W, J- G$ G3 V3 @

  63. ' u6 N1 H& }$ X9 I) b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ]4 k) b7 n/ Z- @) n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X7 a1 B4 Z* A3 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M- a& V7 N" h1 J2 s9 V0 t

  67. * M) u$ X; @" Z7 K
  68. dma_addr_t dmaphyssrc1 = 0;
    3 o) x. ~# P) q0 [: U* H% F$ O. \
  69. dma_addr_t dmaphyssrc2 = 0;) u2 M5 Y# g5 G; C9 A# z4 j/ ~
  70. dma_addr_t dmaphysdest1 = 0;
    " O/ ^# F- B- p. W& ?" t  P5 o
  71. dma_addr_t dmaphysdest2 = 0;: x' T6 q1 y: U

  72. 6 n" G5 N7 G7 Q* s: ]+ R  {
  73. char *dmabufsrc1 = NULL;7 m8 J$ a. ~7 s3 d2 v! x. K6 e
  74. char *dmabufsrc2 = NULL;
    6 j4 H9 ^: {3 {$ Q
  75. char *dmabufdest1 = NULL;
    6 y) Y" J% f  ~  p$ n3 p4 s
  76. char *dmabufdest2 = NULL;
    7 Z7 y6 u! ^* B

  77. 3 ], q6 \! V1 M; h' n+ ]
  78. static int acnt = 512;
    : B3 z7 K" |* ^, v( q; Y% L
  79. static int bcnt = 8;2 p; U# {* R& ]: L- N; i* J
  80. static int ccnt = 8;7 w* Y  W5 `1 l8 w1 \% `

  81. / \; H0 L: ?$ D: `" m5 P
  82. module_param(acnt, int, S_IRUGO);
    + `' z# `9 _: A" n- ?
  83. module_param(bcnt, int, S_IRUGO);7 D0 }$ b4 g+ T: K  Z/ R- q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! y4 b7 M1 H* s- Q* j2 b: `, @7 F$ B1 D1 D/ R: `+ U" U. |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 S/ L; v8 Y9 [2 o5 Q" f5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 O% o& C: b+ w, i& W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 x+ Q3 D0 H3 ~) Z: C# S& r
' q/ @5 S9 r' S5 j& J; v$ r

* ~+ C  N" P! Z- Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 11:12 , Processed in 0.045972 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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