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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ n! H: g" N: T# C5 p
  1. [code]EDMA sample test application
    - m! Z6 {" g. c2 C& T2 N, O
  2. /*5 V. H: S+ u! b9 @0 a
  3. * edma_test.c
    1 {4 ]- A3 J+ U' c2 @2 O8 b& t4 I3 M
  4. *
    $ k: j0 u9 Y1 `* X  r. u* w- U; G
  5. * brief  EDMA3 Test Application0 n3 @0 j& U2 p4 B- D* i, t
  6. *; |6 W4 Q5 Z; m7 v" G
  7. *   This file contains EDMA3 Test code.# M, c5 E" b# E
  8. *3 F3 E" |  {: w; A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ ?" P  y$ Y4 s4 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " U+ l, N, O3 O& {- Y4 ]5 i8 z
  11. *         TO CHANGE.
      M+ N' [4 |8 d& a4 \: w
  12. *
    ; I+ K% L2 ~/ x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# R4 x  M2 `1 }
  14. *
    2 }' ?* d  A, i, V9 l1 s0 J
  15. * This program is free software; you can redistribute it and/or
    2 N9 n/ o0 ?( E$ ~+ w/ O7 @
  16. * modify it under the terms of the GNU General Public License as( k6 f+ U. M3 g. D2 |
  17. * published by the Free Software Foundation version 2.; l) V; ^4 Z% `0 d
  18. *% N2 U( v2 m! L0 W% `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ ?' [, V. M8 j) s
  20. * kind, whether express or implied; without even the implied warranty6 c' {+ Y9 _$ G& P- X6 Y6 I9 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 \: i6 P, L& |' p  m
  22. * GNU General Public License for more details.
    3 j3 ^2 B$ {  R: I  ~
  23. */! T) Q1 h# o' P0 h& L. F* f

  24. , C; b5 h' v# V5 ~$ b, L6 v
  25. #include <linux/module.h>: U& d: H0 N9 T, y% ?7 m7 P' G, u
  26. #include <linux/init.h>
    ; a4 c; [' s6 h" T; Q- G$ K
  27. #include <linux/errno.h>
    5 B! R) J" J1 o& ]) b! ~4 z
  28. #include <linux/types.h>) |7 v+ I1 C7 _" Z; l5 L
  29. #include <linux/interrupt.h>7 r4 l; I" w$ a
  30. #include <asm/io.h>' A$ ~6 b2 O) T& A! @2 Z2 ~
  31. #include <linux/moduleparam.h>1 s, I% ^- L6 j- J# M. |" @& Y
  32. #include <linux/sysctl.h>2 J9 p# K9 E. h
  33. #include <linux/mm.h>+ W, ^! P" I& D/ {% ~
  34. #include <linux/dma-mapping.h>
    3 b7 t" B5 `$ Y  }) z+ Y
  35. % c, y) N: n9 B) o6 Y& o$ n4 {
  36. #include <mach/memory.h>
      q3 \( i1 j# H
  37. #include <mach/hardware.h>
    ! k- u+ K, j# \3 p4 t
  38. #include <mach/irqs.h>7 X: D) r: z' f( M$ R: g( J
  39. #include <asm/hardware/edma.h>
    - M# c( X6 A( i/ t

  40. 9 W& u8 H9 q! @- B2 D7 Z3 j
  41. #undef EDMA3_DEBUG# c  O& j1 z7 ~2 G$ a  y9 M- h
  42. /*#define EDMA3_DEBUG*/3 b, H+ ~+ K6 B" j
  43. - z& P+ e* v5 O3 O2 O# O
  44. #ifdef EDMA3_DEBUG+ j; i0 J% e2 _( t9 S( G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# ]9 ^8 v3 J3 V. d  g- {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 I( U* v+ [, _/ f- r/ [9 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' c6 G7 m0 n+ j3 r( ]* I
  48. #else8 P, L0 l) A: O8 V' n
  49. #define DMA_PRINTK( x... )& P6 n- d  X5 ~
  50. #define DMA_FN_IN
    3 _9 l( c& ]4 {9 T# X. N! t' @+ h) Q
  51. #define DMA_FN_OUT
    1 W. n0 _3 w$ I# \2 S+ q) ~* y& G8 J
  52. #endif
    & `/ o! ?* n$ n

  53. $ z# k( _! G4 ?+ \6 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . q- M! n; J* E$ j+ F& d
  55. #define STATIC_SHIFT                3
    # }% J) U; h. s5 g
  56. #define TCINTEN_SHIFT               20, U/ B7 H! W. i5 r* Z8 N% ?# m& j
  57. #define ITCINTEN_SHIFT              216 H. O# `0 O: Q: C: v
  58. #define TCCHEN_SHIFT                22: H( F7 {5 @2 e8 t% u6 a
  59. #define ITCCHEN_SHIFT               230 i0 U- k, e/ F) l: }5 B5 A, _
  60. / G1 I, @. X) r0 o! Z2 b- ?( d
  61. static volatile int irqraised1 = 0;
    ' B, y$ D! `) x# ~
  62. static volatile int irqraised2 = 0;
    , K  c. \9 r  n. a  b% Q3 [

  63. 6 u. k* g0 w% {: d( [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 G! t9 _* ?& @) |- Q8 g! O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y( ~4 h# y; Q! O, K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 k3 W1 r# I0 L* X! w

  67. : K3 m& J% c* k# a3 l, m2 o: I
  68. dma_addr_t dmaphyssrc1 = 0;2 l  W1 x  N- ]3 x, G8 M
  69. dma_addr_t dmaphyssrc2 = 0;  s& P/ J! ]( e; @8 j; I# e7 n
  70. dma_addr_t dmaphysdest1 = 0;
    ! o$ n- @  t( K) [/ }% s, |5 N8 U
  71. dma_addr_t dmaphysdest2 = 0;3 q- U' e7 x/ T' n$ Z

  72. ! I1 S& X4 ^4 U. H
  73. char *dmabufsrc1 = NULL;( {1 C* x6 J6 R8 H- W- h- A, X/ Z5 R( X
  74. char *dmabufsrc2 = NULL;  h0 O! k6 g( S7 p
  75. char *dmabufdest1 = NULL;
    ' r. P6 U8 n# q; o4 S! p9 P
  76. char *dmabufdest2 = NULL;
    ) d7 W! H% n; H6 v# t
  77. / |8 x& P+ ^* R# s
  78. static int acnt = 512;! b* P" k$ a8 d6 T( E2 e
  79. static int bcnt = 8;
    0 b7 q4 l. a/ }" ^5 X8 @
  80. static int ccnt = 8;
    3 `# i  b: d, g3 l' R
  81. " f9 V+ P, k$ L; e% {  }
  82. module_param(acnt, int, S_IRUGO);
    - K4 W( ^, A$ k  i
  83. module_param(bcnt, int, S_IRUGO);
    & \) |- J; Y6 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; O- h1 l6 b8 b% B  [8 f3 u
: a" s8 y: t& b" u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: n! D4 X7 ]( x% C' g/ C. Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 ~) w- _4 W& ~$ Y& w' D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 F# y9 Y* H6 G% X, A8 i$ y" e1 U

5 f: }( E) K9 O8 t
) E$ f/ ]. l. S2 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 16:30 , Processed in 0.039917 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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