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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' z" P' p5 v6 g2 W. |' {" d* j0 |
  1. [code]EDMA sample test application
    2 C- u' Q4 `# ]0 P0 j
  2. /*
    2 @3 N( [$ V4 A& \4 m, b- y4 ]8 }
  3. * edma_test.c
    . c5 k$ F2 t. v& [/ k9 E
  4. *5 l  h1 D; E) J1 [! c7 W. i* ?! X! Y
  5. * brief  EDMA3 Test Application& l  A5 p4 D' Z4 g/ C
  6. *) y- F0 O7 P+ c
  7. *   This file contains EDMA3 Test code." Z% x3 _7 X/ |% Z1 g/ G* g/ U
  8. *
    ( B7 h( J2 c% F- h; r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 M$ }) g, m0 `+ k, \4 H1 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 {: _# r) Y4 C$ G
  11. *         TO CHANGE.
    0 o  `$ r  w) `7 ^* E2 l3 b
  12. ** |" T; t2 D+ N8 f' l+ c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// }/ z, R4 r) n. a$ R# ^6 _
  14. *
    " x0 @4 q: S7 i  x
  15. * This program is free software; you can redistribute it and/or
    " p" Y) u! A  B1 P/ j0 U4 O
  16. * modify it under the terms of the GNU General Public License as4 Y" @* z6 C* B/ w$ A
  17. * published by the Free Software Foundation version 2.+ j8 J) E& @! z- x7 Q. o. Z) M- W9 ^2 \2 `
  18. *, s) C( k" b* }' y6 a3 C' J; J3 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Y: h+ Q  k+ b. w3 Z
  20. * kind, whether express or implied; without even the implied warranty
    % {' ?2 E- _) n3 o( s0 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 `( f+ u* ?1 k2 Q' s% S
  22. * GNU General Public License for more details." d, u$ A( S/ z( @
  23. */9 Y8 \- }7 P- `2 B$ `  h4 `' i
  24. 6 ]) D/ K- Z% }- C# i. u) j9 f
  25. #include <linux/module.h>
    % z1 E. {+ @7 w. }' A6 Y
  26. #include <linux/init.h>
    ) L, g  G1 q# E7 w- \
  27. #include <linux/errno.h>' n9 Z  n! G5 _4 u
  28. #include <linux/types.h>8 E% L( o! H8 \8 m8 k
  29. #include <linux/interrupt.h>
    7 g3 p1 m, A1 x0 D" ?9 ]
  30. #include <asm/io.h>
      R4 Y, g$ u# e$ h+ b7 g  D
  31. #include <linux/moduleparam.h>9 T; a! B- }; `1 c8 Q6 j) m: X
  32. #include <linux/sysctl.h>
    ; k/ G9 \  ?: ?6 Y
  33. #include <linux/mm.h>! D6 N$ c7 l5 }: W6 ~; g* o1 j
  34. #include <linux/dma-mapping.h>
    3 S) x  |$ ^. X2 B! m- ~+ v

  35. ! s* y: t% F) V3 _$ u6 a- j: Y
  36. #include <mach/memory.h>* j" w% H/ k% t- @  g  ~; A9 F/ c
  37. #include <mach/hardware.h>
    7 K, U6 u8 j% L. }# b! |
  38. #include <mach/irqs.h>4 F: c' l* S% |: P
  39. #include <asm/hardware/edma.h>- Y. e' c7 v* w0 }9 G9 c+ E

  40. % C4 X- \: \1 g7 a  Q
  41. #undef EDMA3_DEBUG
    ; v; F9 w5 L2 v( A1 c/ L
  42. /*#define EDMA3_DEBUG*/" A$ Y4 `* V9 j4 R3 ^% K

  43. % U5 g4 \: v9 c' j2 U0 |, o  F7 q6 U
  44. #ifdef EDMA3_DEBUG
    ; Q0 a* c2 n' Z9 g4 B8 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " p$ p; ?  c, c- }+ J6 b- Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 Z" v9 Z- }% u* R+ X! P/ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ T5 c5 r$ R7 k4 @) Q  u# O0 W" @. V
  48. #else2 }0 p6 X! H4 l+ M3 d" U* u! E
  49. #define DMA_PRINTK( x... )5 o! u* \8 V; U& G7 ~4 i# m! `6 `
  50. #define DMA_FN_IN# ], W; w* z( Y; k
  51. #define DMA_FN_OUT
    4 n* n# `9 I( j, L, V
  52. #endif
    $ D# U5 q! G5 D( L2 M

  53. - a* l3 v% ~; l8 J3 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" B# W0 X) }) J* P& F! s
  55. #define STATIC_SHIFT                3
    ; x* m# v- ~  Y1 G% y
  56. #define TCINTEN_SHIFT               20. m* Q4 P; j) ~: n
  57. #define ITCINTEN_SHIFT              21
    6 ?1 e- B: G) t) Q0 N
  58. #define TCCHEN_SHIFT                22
    # r6 e& d. |" e& m: t# k6 s7 I  a
  59. #define ITCCHEN_SHIFT               23
    . ~% E) q5 T  }8 |

  60. & c0 g6 U# H5 j
  61. static volatile int irqraised1 = 0;  c! w' K" O% L& p8 e- p
  62. static volatile int irqraised2 = 0;3 Y$ c) B3 r1 m2 h% F* X8 G

  63. % G) C( ~" z/ U8 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - U9 U' N' F# J) A7 Z0 m3 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % a$ j# S, U: ]1 l' d1 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" h7 i3 h/ O: s( K, D& ]# N

  67. 6 P, n5 y! o& O9 g3 ^
  68. dma_addr_t dmaphyssrc1 = 0;
    + o& k* c$ A) k: k; Z/ J! r" p
  69. dma_addr_t dmaphyssrc2 = 0;7 o- c/ o" P8 h7 A
  70. dma_addr_t dmaphysdest1 = 0;
    ( q- L* w) |( d
  71. dma_addr_t dmaphysdest2 = 0;
    : N. N" X; ~/ b, e7 |" `

  72. ; N" A, i$ p/ v+ k! \) D
  73. char *dmabufsrc1 = NULL;
    6 l% T9 y4 w4 U9 d8 ?4 ]$ f
  74. char *dmabufsrc2 = NULL;8 S5 z5 g  C0 T% s3 r
  75. char *dmabufdest1 = NULL;
    ( Q9 R9 F6 V( _% W3 V8 T9 k) Q
  76. char *dmabufdest2 = NULL;( v& ]( y& n( k) u  {  C
  77. % `: b2 L: X* s1 [/ Z" C0 z( A
  78. static int acnt = 512;& {" N. c2 j6 I2 G* A. v) e
  79. static int bcnt = 8;
    % F; k( O* x! J5 C- ?2 w2 ~* G+ j
  80. static int ccnt = 8;; d% P  }) ]; i& e6 h* F! D
  81. : r  t3 M5 x% H$ n6 Y, n, ]
  82. module_param(acnt, int, S_IRUGO);, c7 T2 k- B9 o2 l5 ]
  83. module_param(bcnt, int, S_IRUGO);! H! |8 O- W) @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 w5 @$ v' {2 Q" n1 C9 X: D
4 W8 V) |2 z+ R' u8 t# H$ K$ G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; {, _4 r6 ]( Y) Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- n  _- u) Z- l4 R  g$ {2 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 S% A' j2 K# u; D7 D- g: |
8 d6 q! O5 m1 a- K1 o! d! l" {9 z2 {
0 Z* q, e  ~3 ~9 Z# t9 G9 L- L# x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-27 16:45 , Processed in 0.044498 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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