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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 E  y8 K% A/ O0 N; ?* w
  1. [code]EDMA sample test application
    2 Q; G/ M( z5 J3 o
  2. /*, L4 e/ A. G1 k; t
  3. * edma_test.c
    7 z3 y) Z3 g9 c3 `' Q9 j( i
  4. *0 Z: W+ H* T) V# b6 Y' D
  5. * brief  EDMA3 Test Application1 s8 f2 |# ^0 R- [; t$ y8 {2 R8 w9 X
  6. *
    5 a' p; Q$ b* u0 [& n7 _0 }
  7. *   This file contains EDMA3 Test code.
    + E; u! M. D  O& k9 z
  8. *
    & C8 y, i- n9 V8 r7 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 V1 }2 T. u- A9 `+ m$ F( H9 F) U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # ]6 N9 E5 I; {8 Y9 V& r$ y( g5 R
  11. *         TO CHANGE.+ [6 h! H/ H. a2 ^+ Q' V
  12. *
    ! e3 M$ n5 A6 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 a/ N" K! ]1 _% w7 E& I  i9 i3 b
  14. *8 ^; m6 _9 N7 }& D
  15. * This program is free software; you can redistribute it and/or
    5 E+ h5 k) ^8 Q! `4 H0 v) k1 D+ }" W
  16. * modify it under the terms of the GNU General Public License as
    0 A" B7 i* O6 Q* u+ l
  17. * published by the Free Software Foundation version 2., C) [8 g: s1 s
  18. *
    7 b3 ?  n$ S& E0 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 p0 F+ e, f4 X  d" y' s/ N
  20. * kind, whether express or implied; without even the implied warranty
    # P% w) k7 Y2 [( Q  `: ~( u/ k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . f/ P* U  a, }" g# W4 N
  22. * GNU General Public License for more details.
    - s( ]+ R) p+ c2 S
  23. */8 P' ?1 E+ R: h: P

  24. ) V4 E' k- L; [4 }4 m8 Y
  25. #include <linux/module.h>
    3 b% T: C' r' s8 C" J
  26. #include <linux/init.h>
    % Y9 q; a" W) j% g. p
  27. #include <linux/errno.h>- z! m7 i# I/ |9 D/ ]& G
  28. #include <linux/types.h>
    6 X# W/ X8 F9 p" |. o7 L, F
  29. #include <linux/interrupt.h>
    2 H! E1 O8 ^. n* `
  30. #include <asm/io.h>, c" d9 G9 D/ l- d+ e- O1 z
  31. #include <linux/moduleparam.h>9 ~1 v; }8 V, Z
  32. #include <linux/sysctl.h>1 G1 O1 A% e% W5 w
  33. #include <linux/mm.h>
    . L* C: S" A1 c( F8 J5 f
  34. #include <linux/dma-mapping.h>- y: y. i! w6 ^* X/ \
  35. 8 f( g" F3 P: l$ a' J
  36. #include <mach/memory.h>/ y6 Q" ?: {  v( L  x
  37. #include <mach/hardware.h># H- V; Q" [5 }* i; @9 V* N5 L5 i% k
  38. #include <mach/irqs.h>3 B, y7 U1 A. v! h3 k: k
  39. #include <asm/hardware/edma.h>6 Z/ J# ]8 N  U5 G% ^/ ~0 L1 B  z* ~' t( W* B
  40. ( o' p4 [/ q3 E3 u
  41. #undef EDMA3_DEBUG( D& ~1 C6 v" O' N% a
  42. /*#define EDMA3_DEBUG*/* p# ]( J3 |/ [; C3 p: n
  43. 1 B4 B* C2 k+ F
  44. #ifdef EDMA3_DEBUG5 W5 U6 y' z6 d# p7 T' l5 x) [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ?! D6 u, e4 }7 I5 A5 k5 b5 c% {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / h# R+ o7 A  y4 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), r5 J( y. F4 r. @
  48. #else7 I% ]* d) a* c) J
  49. #define DMA_PRINTK( x... )
    - T* ~& z( |. b* V  }/ L) ^) m) N
  50. #define DMA_FN_IN* k0 u& G8 g( a' Y$ z, x3 j
  51. #define DMA_FN_OUT
    ( l7 y# H% c5 _' a+ L& ?3 h. a
  52. #endif/ u8 O7 D7 ^# k2 j6 l& [' }' J

  53. $ r6 e8 u( G% \! G- i' q& a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! K+ ~  o3 L; d: P- g) l' g
  55. #define STATIC_SHIFT                3% S2 m# M& s* \* w/ X  g1 x
  56. #define TCINTEN_SHIFT               20
    1 B+ y. p+ S, c, t  q
  57. #define ITCINTEN_SHIFT              215 ^2 _: ]; M5 y$ t+ U
  58. #define TCCHEN_SHIFT                22
    ; k+ G# O, N3 }4 I& f& x
  59. #define ITCCHEN_SHIFT               23& A  H+ o* }8 {

  60. 3 S7 I/ P, P1 f" z
  61. static volatile int irqraised1 = 0;8 O0 e  N1 J! R, z* X3 f
  62. static volatile int irqraised2 = 0;8 s! f- S- a. |( M

  63. / X2 I- P9 ?5 r' _6 k0 A/ w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; k3 q' Y& U) i+ p; Z6 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # w6 K/ d$ }6 b9 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& r0 ^! c0 K* t+ l! k6 ^
  67. . c; m4 q& f6 N7 {3 ?
  68. dma_addr_t dmaphyssrc1 = 0;
    . j3 |  i9 o( c" u: {4 M! K. m
  69. dma_addr_t dmaphyssrc2 = 0;) P* i" N, {" P- L
  70. dma_addr_t dmaphysdest1 = 0;& N5 f! ~9 e! K2 d2 f9 _' y" h
  71. dma_addr_t dmaphysdest2 = 0;
    $ M; N4 S; S3 r, R
  72. 3 f4 C. P- J# q: L* r8 ]6 l
  73. char *dmabufsrc1 = NULL;* X7 `. r% ~6 }, w5 _9 M
  74. char *dmabufsrc2 = NULL;4 l4 h0 X" b! {$ v6 n# [
  75. char *dmabufdest1 = NULL;% H% Z5 E3 H4 n. Y* d/ X
  76. char *dmabufdest2 = NULL;
    / f- L$ y/ ~8 Y9 P, C4 ^
  77. ! r8 i4 ?. C$ g2 ]5 k0 A1 R
  78. static int acnt = 512;6 G' h/ ]; T- |; `  n
  79. static int bcnt = 8;& M* @$ a7 A- J
  80. static int ccnt = 8;: F; z& M8 o; M$ R8 |. b

  81. " I/ a9 X; L8 e2 Z) x1 o% r
  82. module_param(acnt, int, S_IRUGO);) J0 C2 z9 `2 a. y1 e, N7 I4 K% e
  83. module_param(bcnt, int, S_IRUGO);+ o# F5 O6 f0 k/ f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ Z- M5 V+ q% g) Y; n. J5 ^/ `

! {. ~# @5 o' K4 F: s+ t8 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ D0 C0 v2 J) j: a3 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' r" v# B9 k8 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 Q& b2 x* x9 ?
- v) S+ w" f$ q7 Y/ q" x" E( p% V- y+ I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 09:15 , Processed in 0.040117 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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