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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! Z# Q% W6 N4 F: L4 f
  1. [code]EDMA sample test application
    + o5 q) Y. r9 a
  2. /*# t  t6 N5 \7 w' t0 ^
  3. * edma_test.c
    - y" v( }8 j9 A9 @# U' \* I; R
  4. *9 ]( O6 T/ e; ?+ v- l1 S$ B
  5. * brief  EDMA3 Test Application8 h2 L, i, _; k& A, `
  6. *
    5 h  c9 T9 ^+ b4 ?7 k
  7. *   This file contains EDMA3 Test code., u  v3 j! q# l) ?" I* F2 V8 W
  8. *
    ! Q/ A$ F) G$ T( M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) `7 N: c. @/ S* ^4 J) p8 B$ b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + @. e% J- [3 S
  11. *         TO CHANGE.
    5 B# E2 p9 k* L+ x( D
  12. *. I0 e; \+ e5 N) j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ g. c: P% ~. l# ~, v8 ^3 _( m, I
  14. *; E+ A; p; l9 k  k$ l3 i
  15. * This program is free software; you can redistribute it and/or
    9 S( i& ~' R; ?& u% \: H- h2 t! Y
  16. * modify it under the terms of the GNU General Public License as' B) R5 R7 d1 v" Z
  17. * published by the Free Software Foundation version 2.
    & Z0 x  e/ Z5 m& G4 m/ P+ q
  18. *; A) g% V# Y! b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% S0 ^% _  L2 F) k/ B) Q
  20. * kind, whether express or implied; without even the implied warranty) l9 g3 g7 I* y6 v+ v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % n$ A# ?! z4 T1 m; J9 S; b
  22. * GNU General Public License for more details.' _7 O! K+ F2 _8 ^* c6 N" j
  23. */1 j7 q6 `2 ?1 ~, z" D2 ?' e& }
  24. : {- j9 c/ @! \7 C4 }6 v# c
  25. #include <linux/module.h>/ Y# Y5 z4 r6 F& E3 \# S( l2 D
  26. #include <linux/init.h>/ h. `! L8 ~) e6 n' v4 B
  27. #include <linux/errno.h>- z- J1 u3 u9 a+ S; p
  28. #include <linux/types.h>
    / @$ c; V% m3 l9 w2 n" r: e
  29. #include <linux/interrupt.h>0 V, c3 @7 m) `' F8 x
  30. #include <asm/io.h>! h' R7 v% _6 P9 {
  31. #include <linux/moduleparam.h>
    3 P+ b/ t- S% n. ~
  32. #include <linux/sysctl.h>5 }* E3 [0 `  f/ j: F1 k/ x5 Y5 n; {
  33. #include <linux/mm.h>0 f1 V3 d6 a/ b9 f& d4 ]5 H4 U1 \
  34. #include <linux/dma-mapping.h>
    . Y1 ]1 l0 e, b' A( K

  35. & u8 s: C6 u, h, j. [9 O
  36. #include <mach/memory.h>9 j6 r5 m& N& r" P! N
  37. #include <mach/hardware.h>' E, z' g, c/ ]# ~  K
  38. #include <mach/irqs.h>
    3 j+ e; ^0 y: L
  39. #include <asm/hardware/edma.h>
    3 @, ^$ _9 b9 v: N. `9 p7 g
  40. / z7 m: q9 i; ]$ }- b5 R
  41. #undef EDMA3_DEBUG6 K" I0 `# `' D; P1 `, T) o9 F1 s
  42. /*#define EDMA3_DEBUG*/
    + k0 r# a' u6 \( x/ M& p

  43. $ `! L) S+ m( B# R3 G
  44. #ifdef EDMA3_DEBUG
    7 X2 R5 H8 ~$ r; l3 E5 y$ ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 L/ e) q  j% L. ~8 }" F4 L+ V9 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * z! Y. Y  K/ |  A4 P) d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 M6 z1 j0 r  _) b  C- Q( |( H
  48. #else
    ' w) ?: E1 v2 ?
  49. #define DMA_PRINTK( x... )- R8 l4 ?+ T6 j/ F  D6 J' ?
  50. #define DMA_FN_IN2 H# u/ O- v7 U7 e9 T
  51. #define DMA_FN_OUT
    3 R& q" u  x% `% ]. B8 {, U
  52. #endif
    0 j, S7 c# t5 _
  53. 0 f  V4 U  j& M% ^  _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 t5 b+ O. L1 K1 K" K; s3 v8 m1 D
  55. #define STATIC_SHIFT                3
    5 [3 y# m7 H( z# t
  56. #define TCINTEN_SHIFT               20$ s4 P* o) d& H6 [
  57. #define ITCINTEN_SHIFT              21! B5 w4 ~8 s% B8 x+ O
  58. #define TCCHEN_SHIFT                224 _1 }& A* U7 R
  59. #define ITCCHEN_SHIFT               23
    / _% A1 T7 o& g

  60. ; H; j! O/ Y" B0 h" n$ s
  61. static volatile int irqraised1 = 0;( P6 z7 ]5 O) h; R7 ?
  62. static volatile int irqraised2 = 0;2 `4 H& A8 S' r0 x" ^8 u

  63. * {2 ~4 S# Y% x. b6 ?5 A" |# c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ^5 s9 o4 r& a; h, U( H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 f; P: p0 d( a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ t% t$ o$ @& a4 _$ X
  67. & f8 G" {% R/ s) H; x' Z! r: t
  68. dma_addr_t dmaphyssrc1 = 0;
    ' \$ D0 ]2 Z" o. H& i3 P
  69. dma_addr_t dmaphyssrc2 = 0;' v! K5 Y4 y) e, G- w
  70. dma_addr_t dmaphysdest1 = 0;% A1 U* \' M. {% g# D$ L; \
  71. dma_addr_t dmaphysdest2 = 0;3 I7 k, f; M& Y+ T/ s

  72. 8 C3 |+ P  [5 j4 b4 X3 ~& ~( `
  73. char *dmabufsrc1 = NULL;& q+ U; K# `5 s, z
  74. char *dmabufsrc2 = NULL;
    8 ~0 F8 U5 U: g" l2 l* P
  75. char *dmabufdest1 = NULL;
    . ^" A( Y0 T. Q
  76. char *dmabufdest2 = NULL;: Y) U7 D! B$ z
  77. . E- a! O" V1 M; v( E  X
  78. static int acnt = 512;
    . v6 n" G/ R0 }' x& i
  79. static int bcnt = 8;
    3 r# F$ o$ W' S  ?1 v
  80. static int ccnt = 8;4 B. |$ T: K8 m

  81. ) ?3 R$ ~% v7 E) r( A& I
  82. module_param(acnt, int, S_IRUGO);2 B9 F# E" E+ b; ~
  83. module_param(bcnt, int, S_IRUGO);
    " r* a- ?6 u* @& ]& V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, P+ D: i1 ]' |7 g3 @' i$ k% X" Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" L) {. R$ J1 {; R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* ]: p5 l/ f8 ~, v& G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ?9 _8 h5 ~8 ^; H. n) ?5 A# y6 a5 W$ \% h( r! [  j: d9 q

2 m+ b/ W' G5 y) Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 07:55 , Processed in 0.039290 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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