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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ U0 i0 f" }$ B7 Z0 a2 n* I2 k+ W
  1. [code]EDMA sample test application
    5 l& O7 O4 T+ @7 P4 _
  2. /*2 a3 ?8 I6 Z5 v% E1 x; d
  3. * edma_test.c& w9 \9 h& j8 K+ n: J
  4. *
    . {' b5 o5 |! H, f: b( u
  5. * brief  EDMA3 Test Application2 z5 q' {' b( u' H
  6. *
    7 S& |" ~. }! X( T2 O3 Z, I: G  }7 D8 Y
  7. *   This file contains EDMA3 Test code.# v' L$ I1 `/ A% Y: R9 b6 y: B
  8. *; X* Z8 B: m9 _, c; g* Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ s( t- ]4 m8 k0 q% H$ t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 ~; p" ]7 V: L0 ~
  11. *         TO CHANGE.
    & u/ {" J, n, ]# [0 {' [! n8 Y
  12. *; {- D! G6 J- k" @  y% Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : u" x8 ]# V. S+ [* Q
  14. *+ J6 t. u4 f9 [" y
  15. * This program is free software; you can redistribute it and/or+ u6 z3 {1 Q. G% k$ X  v7 e; _) J  k
  16. * modify it under the terms of the GNU General Public License as
    ( e% c- P) z# u+ Q; Z3 _
  17. * published by the Free Software Foundation version 2.
    . ?4 U/ n& P) {3 p# C/ t
  18. *6 ~8 G4 E: k8 s$ ~$ m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : o1 r& t9 t# i' r
  20. * kind, whether express or implied; without even the implied warranty( z6 d' |2 [3 f& c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 f% S" f$ {4 }% W' {
  22. * GNU General Public License for more details.
    0 c( M8 k7 N5 a7 P1 `
  23. */& o" [7 E7 ]8 B4 t5 ?7 [. E

  24. 6 r/ F* w4 w( ^9 d) v# |* s3 a* ~
  25. #include <linux/module.h>" N7 r' R$ W: Y- L9 _
  26. #include <linux/init.h>
    # D0 ~( l* N  z1 ^! n7 A+ E' H2 u  J5 k
  27. #include <linux/errno.h>
    8 c5 P2 z3 ?" N' j. q
  28. #include <linux/types.h>
    7 [- O% u% F  U1 M, V
  29. #include <linux/interrupt.h>
    - h, @* }5 N8 ^; Y6 t6 e: I
  30. #include <asm/io.h>
    . W4 ?! ?6 m* c. _7 q0 S$ |
  31. #include <linux/moduleparam.h>: a" n8 N: s4 C0 T# i
  32. #include <linux/sysctl.h># j. X, D) J4 m
  33. #include <linux/mm.h>1 m- B4 o/ o+ M# g/ }1 U
  34. #include <linux/dma-mapping.h>* L' _7 l2 s; X# N! J2 H0 c$ d% F
  35. ( D( z1 l/ Z* Z
  36. #include <mach/memory.h>
    2 _) P* {) x% U) N5 T3 g1 D
  37. #include <mach/hardware.h>9 g2 a7 p8 o. j. Q' k
  38. #include <mach/irqs.h>9 k2 b  \+ B2 q& u
  39. #include <asm/hardware/edma.h>$ N# B7 f' b1 \- j
  40. 6 r8 b1 }# \* z- f4 q1 C& J* G
  41. #undef EDMA3_DEBUG; p  J. x1 T. G9 G/ ^
  42. /*#define EDMA3_DEBUG*/* O" l. ]3 W) v2 V
  43. 3 N) c. E4 s- _: z4 e5 V! I; D
  44. #ifdef EDMA3_DEBUG
    9 H% O" N" _5 D* y  V9 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! k* O* j$ \  g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 u! }; d! J: r3 ^* H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * {4 B" ]: s4 t6 R
  48. #else
    ' G8 b5 Z4 u. Q' Z* w8 l
  49. #define DMA_PRINTK( x... )9 Z# b, P- Y  }
  50. #define DMA_FN_IN
    ( L1 P9 k6 @" D# ]4 v6 z
  51. #define DMA_FN_OUT
    4 ?" I( m2 d1 K9 E( ^" K& H; \3 [2 B% S
  52. #endif
    # R# X  {4 l( a$ M# y
  53. # P' P' v: w& i" N/ T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      `. Q! J% `  @$ L% M1 \1 b
  55. #define STATIC_SHIFT                37 {1 f4 a& Y5 o& {6 l5 u
  56. #define TCINTEN_SHIFT               20
    1 j- m: p# r5 w
  57. #define ITCINTEN_SHIFT              21
    : z2 M* j- i  M8 J+ B' ^* _* j+ Q
  58. #define TCCHEN_SHIFT                229 l6 i# ?$ J2 w% g. Q; O& M
  59. #define ITCCHEN_SHIFT               237 ^: B1 c4 r# b! J
  60. 4 j8 n# i2 S5 x: J/ G
  61. static volatile int irqraised1 = 0;
    6 b& u) Q& ]# ]# Q
  62. static volatile int irqraised2 = 0;+ I8 L2 L7 F* J

  63. 4 [5 a9 V* B7 Y, C4 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  W2 F9 \. |$ y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) }1 T: ?+ I2 W5 w" y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 M3 o6 @& j8 e$ S5 v; D1 l$ ?

  67. ) c$ K$ m1 R3 E/ H
  68. dma_addr_t dmaphyssrc1 = 0;
    * `3 b4 k" i$ q" _: w
  69. dma_addr_t dmaphyssrc2 = 0;) i: `! o4 k: X! i- w" w
  70. dma_addr_t dmaphysdest1 = 0;4 F7 z/ W/ f  k. N
  71. dma_addr_t dmaphysdest2 = 0;
    8 F+ {! v$ t/ d7 R; o% u

  72. ! S  `; I8 E8 ^: z5 h( y
  73. char *dmabufsrc1 = NULL;! W2 y: ^9 \+ M4 G
  74. char *dmabufsrc2 = NULL;9 [9 P; v8 k: U% u
  75. char *dmabufdest1 = NULL;- p8 F/ a7 i: v" Y
  76. char *dmabufdest2 = NULL;
    ( k0 u8 B0 i5 s3 h. o$ p' P/ l

  77. : ~1 Z, D8 a2 f! j9 g  b
  78. static int acnt = 512;
    ! \, @8 A+ e9 Z" ?
  79. static int bcnt = 8;/ v- L) H" k/ m* _! r6 t. @' }0 }& B
  80. static int ccnt = 8;
    : n! Y# z" W' ]7 }" Z

  81. ' w8 H3 y8 A' |, S6 d& G
  82. module_param(acnt, int, S_IRUGO);0 l, U! Z$ l# G& L2 q
  83. module_param(bcnt, int, S_IRUGO);
    : b6 {9 b) p1 \  g7 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 E* V5 _/ |0 f5 l

# a1 y! X: ]& p" `' ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 J5 Q: g# B2 K& t$ X: h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* n6 ~. V. q; D* r6 [) Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* Y; @! ~# E! X  c9 z# Y  m5 E5 T

" t+ c- E# H: d# L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 07:52 , Processed in 0.041918 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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