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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 @0 s. U' G& {$ v, O
  1. [code]EDMA sample test application
    2 G7 a/ M4 n  ]6 A& T+ h
  2. /*
    ' m' n9 N# Z1 q; g
  3. * edma_test.c$ e2 d( F. }& @
  4. *
    ' B2 B/ d2 k8 p& _8 z
  5. * brief  EDMA3 Test Application
    ( h9 ]. y! z0 h! d, y
  6. *
    . k; x/ p0 B4 C  [# S
  7. *   This file contains EDMA3 Test code.
    ' D7 f' \" X# t' n8 b  G* e0 B
  8. *
    ' _7 U/ ^, f( B8 G# C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) \/ B3 K! }5 Z" p3 J7 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # e* j( J% D. t+ a( r3 X* k+ d
  11. *         TO CHANGE.
    * f- d7 N3 C& J/ ^$ C( A6 D
  12. *' o. K3 V) N* z' t  z& J9 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 K* }" b9 C" S% K8 a
  14. *0 }; I" B1 G0 ]' w4 ^
  15. * This program is free software; you can redistribute it and/or1 ^$ g6 ^2 t2 }7 W  `3 z( C$ b6 O; q
  16. * modify it under the terms of the GNU General Public License as0 ]( y0 p1 K0 C
  17. * published by the Free Software Foundation version 2.$ Q2 r; k% B( o3 M  e: G
  18. *
    ( H# ?2 h8 t- j+ E+ O, L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / x  q# M, y- S6 B$ m' f
  20. * kind, whether express or implied; without even the implied warranty
    & C  _2 q5 ?0 u# `2 F0 c9 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - F' _& [7 C- \& p# |2 D7 B
  22. * GNU General Public License for more details.- m3 D4 v8 f" n) L8 ?% z
  23. */, _7 u5 I# y4 M+ N2 I/ _4 \' _
  24.   o+ W7 H$ x7 s5 u8 w
  25. #include <linux/module.h>
    ! i8 Z$ O4 x# X6 ^1 E$ ^8 O6 C
  26. #include <linux/init.h>/ @$ Q4 D9 z9 m! I4 ]0 s; M
  27. #include <linux/errno.h>* ~5 N9 g) Z7 [: c( {3 P) _
  28. #include <linux/types.h>
    ' @  Q- w& {& @8 j! f) M2 @
  29. #include <linux/interrupt.h>0 N! U, k1 v) }; w
  30. #include <asm/io.h>3 m/ b1 K8 e5 \0 l9 I7 Z
  31. #include <linux/moduleparam.h>
    : m+ n/ ?( j: V1 O4 P
  32. #include <linux/sysctl.h>
    ) _7 t1 p( {& X0 }' \+ W
  33. #include <linux/mm.h># M7 Q' Z1 T, r* O
  34. #include <linux/dma-mapping.h>9 |8 C, G  C8 E  S* \9 K8 E

  35. : b9 z" N; D" Y/ ?& E! ^
  36. #include <mach/memory.h>+ t: I; E2 s- _: y
  37. #include <mach/hardware.h>2 J$ c9 X7 f0 S' a" n
  38. #include <mach/irqs.h>
    - O8 Y) t( u" Q1 E# \0 v0 ^- }
  39. #include <asm/hardware/edma.h>" G4 U1 T1 J! }! U# g2 X9 c
  40. ! P" {3 H7 Z# t) q1 B) p
  41. #undef EDMA3_DEBUG
    # u" |$ p" |- A: W0 R. J6 P
  42. /*#define EDMA3_DEBUG*/
    ( K3 Q! z9 ^0 k5 o$ ?9 ]

  43. 1 O! [3 k3 Q/ \; Z- U
  44. #ifdef EDMA3_DEBUG. r/ e- t8 \$ W7 v1 t  v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 w( h; c( G: K2 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 u. h# m' Y* T0 w  j' K5 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' Q5 N) O, Z8 ^4 V
  48. #else
    ) C. Y$ L6 u$ ?; |  Y7 |% L* G
  49. #define DMA_PRINTK( x... ); Y+ d4 O( K8 A+ h5 o- C
  50. #define DMA_FN_IN3 A& O  L, f% _
  51. #define DMA_FN_OUT& p0 t0 c+ c( ^$ u* p, Z
  52. #endif3 S# l+ D0 P0 o7 Y$ m2 ?

  53. $ V& x9 {( t' x5 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      [, R' W* E& s+ ^8 f
  55. #define STATIC_SHIFT                34 I  D9 l# {+ @8 Y+ L$ |
  56. #define TCINTEN_SHIFT               20
    7 ]& a: O6 N& f; E% a$ q6 O
  57. #define ITCINTEN_SHIFT              21
    1 m; {; ?9 ]8 [
  58. #define TCCHEN_SHIFT                22* I" L( h8 Q4 m' C) P9 f& K
  59. #define ITCCHEN_SHIFT               23
    9 D9 r/ J  w/ r5 t& _  e7 l9 a  @- {" k
  60. / R. ]1 ?  M, W
  61. static volatile int irqraised1 = 0;8 ]0 n8 Y8 c9 l  y( b% L
  62. static volatile int irqraised2 = 0;: r, d6 k! a7 ?- X8 w; d/ d5 k

  63. ( @3 L$ j& g5 D* j2 T2 c9 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . \5 I0 T; N, L2 L. ~- n/ s( h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) w9 i1 \" f2 V2 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . r5 K" S- p5 U4 ?! q/ ?

  67. ; {( K' ?- U, c8 {
  68. dma_addr_t dmaphyssrc1 = 0;0 Y+ [& B6 B) J& u8 m! x  A( |
  69. dma_addr_t dmaphyssrc2 = 0;
    / q6 I- _9 b8 I/ V' t
  70. dma_addr_t dmaphysdest1 = 0;
    : i- O7 T0 }% R0 I9 M4 v
  71. dma_addr_t dmaphysdest2 = 0;
      r) M4 P, j$ L0 u
  72. 1 r& m; l; B; u' Q+ ^) q
  73. char *dmabufsrc1 = NULL;7 ^% X' ]3 S& n$ i
  74. char *dmabufsrc2 = NULL;
    6 \+ R8 L& g& e1 p! @* H( c5 l# K
  75. char *dmabufdest1 = NULL;" \% c1 i, ?; `. z. e7 d" S
  76. char *dmabufdest2 = NULL;: }3 H5 @" R6 Q. d4 k

  77. - J, w3 X: X2 r! p3 A, p
  78. static int acnt = 512;5 X! E, o1 A3 X$ e' V0 k  f: i5 L6 }+ n
  79. static int bcnt = 8;  u) M4 u  j# O; q% q' _
  80. static int ccnt = 8;4 ?, ~; v: K6 i
  81. ) K! K5 u$ B% v7 P
  82. module_param(acnt, int, S_IRUGO);6 ?, _! N5 c: X$ t* Q
  83. module_param(bcnt, int, S_IRUGO);
    & q" J" e; }# |' {! E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 e7 f& _: M  O* b! w; Y
+ S0 t/ Y0 Z6 `9 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  \8 _: n1 G, e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: |& e" s0 S. O' M; j, S5 Q) e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" _( S' Z6 g7 U  ^( @4 `+ l. H- e, N# N0 H: M% M+ T
4 a$ m  ^% p9 F& Z3 [' f3 }8 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 22:39 , Processed in 0.041795 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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