OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # Y9 O4 r3 u/ r8 Y# e0 P
  1. [code]EDMA sample test application
    1 [$ R" A: V" V7 w9 Y
  2. /*5 W7 |' e5 M1 Q! E7 _
  3. * edma_test.c* g1 b3 q$ M4 R$ Q6 K
  4. *
    ! E/ a* z5 S" S- c6 O5 c* C% u5 h
  5. * brief  EDMA3 Test Application/ v7 `, x$ d5 q0 h
  6. *
    # v3 [$ p/ K% q5 A( r
  7. *   This file contains EDMA3 Test code.9 `, m3 K" t" V* _- B' U
  8. *' V9 e8 C! o2 J9 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^' f9 H6 f7 S5 i9 I. w7 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) o* g! E" i7 a, P3 ~0 S
  11. *         TO CHANGE.
    2 f5 P' q5 S) `) j5 w& s) v  O# I% O
  12. *% q6 i* A# g+ z$ [& d( n3 `  W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' }. E6 [+ F) k. V' @
  14. *
    % z- Z( c) b7 x1 a  b7 A8 \
  15. * This program is free software; you can redistribute it and/or
    . N- J" u6 \" m8 ^
  16. * modify it under the terms of the GNU General Public License as
    4 V, K# M' y: z( a* N' Z5 N5 f
  17. * published by the Free Software Foundation version 2.5 a" j* f$ \. G
  18. *4 w7 `7 p+ p5 G7 c9 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & f$ F8 q4 `4 g0 p% z
  20. * kind, whether express or implied; without even the implied warranty+ d4 |4 G, r! i0 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 H9 ~: q; C' H
  22. * GNU General Public License for more details.
    9 U' @7 ^' j5 E" K
  23. */
    ! l8 ?$ R1 S+ m: z- ~0 b9 P! ?
  24. ; N3 i( D. j( O, C* z; t* J
  25. #include <linux/module.h>! t6 i/ Z3 w, Z# Q) S$ s$ v6 _! [( s" S
  26. #include <linux/init.h>  y& G: o! i9 ?8 O8 f7 s
  27. #include <linux/errno.h>1 v8 t7 ?; m0 S/ `5 C
  28. #include <linux/types.h>
    . \# c6 @2 Y! G; x8 X) U* Y: r0 Y
  29. #include <linux/interrupt.h>
    2 g% h: \; Z- ^7 ]$ w
  30. #include <asm/io.h>
      Z$ B$ p2 v0 a" I& V0 H3 l
  31. #include <linux/moduleparam.h>
    ; V9 R( v  o+ Q7 N8 W; Y; h* F
  32. #include <linux/sysctl.h>
    4 O! A$ B: R5 r! S5 x  @; r
  33. #include <linux/mm.h>) b: K. U7 Y: k* W" \( z
  34. #include <linux/dma-mapping.h>
    * K9 S! M, y+ _
  35. * d: H3 P3 _; \; D, h
  36. #include <mach/memory.h>
    2 h) Y/ O) v' H/ V% @0 D! a
  37. #include <mach/hardware.h>% r( Z2 R+ C% c+ x1 h; o# N9 ?
  38. #include <mach/irqs.h>" {! b( h' q7 b) }
  39. #include <asm/hardware/edma.h>
    7 R! J" Q" ?8 u) v& y2 N( Q: Z
  40. # z  i! e/ h3 D
  41. #undef EDMA3_DEBUG
    5 p4 |  N5 v* s9 n  k% e. Q/ H8 u
  42. /*#define EDMA3_DEBUG*/1 H8 F+ A/ Y7 i2 Z. M

  43. 8 M! r2 m% b; L7 ?! X
  44. #ifdef EDMA3_DEBUG' T# g2 N# q) q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' N% O& p1 E, @+ A7 O, E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 a9 U7 Q6 Q( G( J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ D3 L( z( T5 @
  48. #else0 v' e- V* C# d  \
  49. #define DMA_PRINTK( x... )
    7 H6 z' C* r4 w
  50. #define DMA_FN_IN
    / V$ z0 |  i' U  V! Z  L5 y! t7 P+ Z
  51. #define DMA_FN_OUT' \& k7 X, a' b& L- h8 v
  52. #endif/ V: ^/ N, Z% t/ A4 A) v! T

  53. . S+ @% y+ d- d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # J, ]$ Q7 A, K
  55. #define STATIC_SHIFT                31 M. z( K4 [9 k' h" M
  56. #define TCINTEN_SHIFT               20! a# h' d. M: H% {9 Z
  57. #define ITCINTEN_SHIFT              21
    " s2 B6 {% h7 d% X) V7 t
  58. #define TCCHEN_SHIFT                222 R- v2 {3 Z7 D9 M& Q5 o
  59. #define ITCCHEN_SHIFT               23
    1 {% r! r5 j1 [3 [' G2 u' [& W

  60. + v. ]! J7 r( U' B; Y
  61. static volatile int irqraised1 = 0;, o1 C0 n3 t! L  _( k
  62. static volatile int irqraised2 = 0;$ W2 c* {8 y$ [

  63.   W8 ^7 p! t# H5 h- n+ h, n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 D! k* j$ X/ Q) ^; L4 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# A7 Q; j( z0 @4 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C, d- ~9 {% U
  67. # J. P6 {0 Y  c: S, n0 n9 S
  68. dma_addr_t dmaphyssrc1 = 0;
    ! b8 A5 u0 z( U  z" X9 t
  69. dma_addr_t dmaphyssrc2 = 0;
    5 J; O4 ?- i' n. D3 c2 A* g7 n
  70. dma_addr_t dmaphysdest1 = 0;
    2 E9 T& i2 R7 t# @
  71. dma_addr_t dmaphysdest2 = 0;
    4 i! O* n( v2 @3 a& a3 |
  72. 9 O1 e1 v" r, F) x/ W
  73. char *dmabufsrc1 = NULL;" |/ s7 S, b( G) S8 i. h1 ^
  74. char *dmabufsrc2 = NULL;1 d" H( Z" A3 ]/ Z/ O
  75. char *dmabufdest1 = NULL;
    0 `0 a- [6 E* [' K# \: z
  76. char *dmabufdest2 = NULL;7 I  b' H7 l2 ^) \

  77.   W; t; k9 C& @# Q! R& q
  78. static int acnt = 512;# Y9 g! U! M% X
  79. static int bcnt = 8;& E- L1 `3 r! F6 x+ l- p* q
  80. static int ccnt = 8;( K4 Z! R7 C8 `& h
  81.   d7 g# {- ]3 |3 Q% w6 j5 f% T
  82. module_param(acnt, int, S_IRUGO);
    ! |2 z# i! d4 E/ J" h1 N
  83. module_param(bcnt, int, S_IRUGO);2 U! o3 P# F/ V8 u! m/ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 s( q- X: c9 k$ \- x( Y0 D$ l* ]) p; C$ n3 n0 B! i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* g$ P; j8 p, T
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" i0 l- W: V; p2 X0 f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) i5 r) a9 V' c  W" v$ U
; k! B; r/ y9 r) W0 p. w3 Y# c$ s( Q* _0 {) T; X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 20:15 , Processed in 0.037227 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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