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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 q, L3 T' Z; E4 M
  1. [code]EDMA sample test application3 H0 G4 R$ P6 `, y3 j
  2. /*
    8 X' f% ~% D% |
  3. * edma_test.c
    ' s4 E5 u+ g$ t6 J1 a: c0 M
  4. *
    $ R7 p8 U% @7 a3 h& M) B( l# m
  5. * brief  EDMA3 Test Application
    2 c9 ?1 ]$ a# I9 j1 \/ p
  6. *5 Q3 x: w4 a7 K& D2 Q& i! ]
  7. *   This file contains EDMA3 Test code.+ r2 p! L5 I! W. S6 ^  c
  8. *$ E2 R, `) s. E* O+ d7 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / M, v/ Q5 k% H8 k# T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      s4 B+ u4 I' j% `5 _# Q) Y- Y
  11. *         TO CHANGE.
    5 q  j* s3 ^/ Y; s4 G
  12. *
    % Z; @- ]+ L7 w+ T  R6 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Y9 A: U  S2 R3 M5 H3 a1 y
  14. *  S- |/ A. P4 X: ]! t
  15. * This program is free software; you can redistribute it and/or/ I) i$ E0 x& `* R
  16. * modify it under the terms of the GNU General Public License as( Q2 U( p# n: |9 Z3 Y
  17. * published by the Free Software Foundation version 2.
    " G; r7 k2 m+ s' v( v8 q
  18. *
    0 A0 r9 K& L) Q8 t/ m0 }* L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 _5 Q( _( S: H3 C4 h0 I
  20. * kind, whether express or implied; without even the implied warranty* W. q: n7 T6 X/ n; z4 I0 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ p& S9 f: G* B/ z$ |$ ^
  22. * GNU General Public License for more details.' h( D% `' U: z& C: `
  23. */
    6 u/ A  I6 o% [3 Q5 b1 r

  24. # }. d/ D1 k! `+ }' Y; q
  25. #include <linux/module.h>" D  |" m, H0 H4 D3 i4 D
  26. #include <linux/init.h>2 ~7 s( Q& T* k; Y
  27. #include <linux/errno.h>
    " R$ p; [6 l+ r! {3 Y' h
  28. #include <linux/types.h>
    ' o7 R. [/ E3 k$ v( P2 b0 ~5 x6 ^
  29. #include <linux/interrupt.h>
    2 E1 I$ P" z. X% Q4 h
  30. #include <asm/io.h>: K5 i1 d, g0 a/ b
  31. #include <linux/moduleparam.h>
    4 z* N: b1 k5 Z* O; I1 U5 O3 ?1 I
  32. #include <linux/sysctl.h>( h0 p' {- K9 a0 N, ?: e: E
  33. #include <linux/mm.h>
    2 [: F" \1 V1 P2 p. F! X
  34. #include <linux/dma-mapping.h>
    . o9 c+ Y0 [4 H' a. c" z. X
  35. , t  M& a: {0 M6 J$ i  o( P
  36. #include <mach/memory.h>
    " g% p) W* s$ P! x+ `: E& R. q
  37. #include <mach/hardware.h>8 m  ^$ M+ S1 @9 Q! f  N
  38. #include <mach/irqs.h>
    2 L( u: r' k5 S" }9 O! H8 g) H
  39. #include <asm/hardware/edma.h>
    0 r: b: z+ U, w" W
  40. ) b' R7 C. N: P
  41. #undef EDMA3_DEBUG+ K8 {) }, Z) j: s
  42. /*#define EDMA3_DEBUG*/
    4 i* }8 U- ]" t( k; i/ r
  43. " l9 l/ a& g$ |
  44. #ifdef EDMA3_DEBUG* |8 O: F! R: O/ T% |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + B; Z4 w4 z) L( ^2 a5 P$ T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & V" E) Q, U6 s( H$ M0 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( K% C* V; u4 e6 Y8 p
  48. #else. b8 G2 c. f: U& x: N- E
  49. #define DMA_PRINTK( x... )
    1 d) H+ g/ L* e* ~
  50. #define DMA_FN_IN
    / @1 u; s% |! e2 c3 a) {$ J
  51. #define DMA_FN_OUT
    2 |0 z, y' j3 y- W. e, B7 [
  52. #endif2 M  P, U9 ^  W
  53. + [: @$ Q) Y2 C* J  Y$ S* L9 p" `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% L$ a9 o# l0 ^" V
  55. #define STATIC_SHIFT                37 P) ~8 R4 x  w0 B9 ]! z7 J- A& N
  56. #define TCINTEN_SHIFT               20$ b- S& Z3 c5 Z8 \4 I
  57. #define ITCINTEN_SHIFT              21  Q# H2 c! \; L0 Z, J4 H
  58. #define TCCHEN_SHIFT                22
    : I; I' ~- i" q1 K3 E0 R, r' E
  59. #define ITCCHEN_SHIFT               235 j- f6 O0 h) M: ?& R' h7 r

  60. 5 a" s1 h6 U% x6 D
  61. static volatile int irqraised1 = 0;. a, S/ X9 z; [( a: s+ I
  62. static volatile int irqraised2 = 0;6 R" v: t- _8 I: u7 \- c

  63. 1 p6 d: I  J) }( P; D/ D7 z4 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 y1 ~" G( V8 e  {( d6 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # J. [2 i  {, V9 b$ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + {5 g9 v3 o% v3 S8 p9 B
  67. $ h$ A9 [6 H: E3 p. R, l
  68. dma_addr_t dmaphyssrc1 = 0;# f$ g3 ^+ b9 [+ |1 ^4 a! d% Q- o! i5 j
  69. dma_addr_t dmaphyssrc2 = 0;
    ) _; ]4 L$ W( ^! E) J$ U
  70. dma_addr_t dmaphysdest1 = 0;& k6 k6 d6 [( ]0 q: V" @2 M; L
  71. dma_addr_t dmaphysdest2 = 0;
    & ^1 l5 h1 C: S- k# ?: P# g
  72. " f- Z* o4 m1 }; U5 o
  73. char *dmabufsrc1 = NULL;0 X* w* l. K4 U
  74. char *dmabufsrc2 = NULL;6 c7 o5 z) A2 Q4 a& ?; C# K
  75. char *dmabufdest1 = NULL;' ?! R! O: {) ]1 X* A! |
  76. char *dmabufdest2 = NULL;
    , d+ f8 ]1 A0 q( S0 m
  77. 9 H+ F7 I" H( V8 N0 d4 f) [
  78. static int acnt = 512;
    3 d& K7 v0 d5 c- ^  U5 ?& D- Q
  79. static int bcnt = 8;4 ]9 O; K, w& w# y% H
  80. static int ccnt = 8;
    9 ?; U2 E' z+ x
  81. ( I3 k: @& a0 e6 d0 w7 K5 X
  82. module_param(acnt, int, S_IRUGO);: A/ A& R. u% v  a! T+ K
  83. module_param(bcnt, int, S_IRUGO);
    7 a* [) V2 z9 l/ f7 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 ?# a) m5 }/ W' `4 T6 _! \+ c" H) o  U  `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# Q4 S" H* L4 m4 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. k! `# h  U& h4 W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' W( ^. W' ]! k& N
9 n2 u2 j) X+ K- S. s+ R
3 j" O- g2 L% \+ P0 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 16:04 , Processed in 0.040065 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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