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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ Y  N& P$ |& _
  1. [code]EDMA sample test application! [1 n, e& `  k, d  E( D
  2. /*8 w  m! X6 R% `5 I
  3. * edma_test.c
    2 [( G$ n6 D! O& H. c
  4. *& V. X7 k" `; E3 B+ i% T+ Y
  5. * brief  EDMA3 Test Application+ }' e  c# n, Q2 z; h  G! T9 {
  6. *# u: S# e, r) U. e5 E- ]9 ]
  7. *   This file contains EDMA3 Test code.2 r) K' @8 N/ ~+ ]' q* c
  8. *# Y7 {' s2 S' k9 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ Q: A& D+ j: |1 u6 K* j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ U) g; n3 C4 _. g9 S$ G( J
  11. *         TO CHANGE.
    - c: A4 @! E; U3 X$ `8 j
  12. *
    2 {9 U7 I& A2 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 z  g! K0 O, }4 \$ q+ F6 v
  14. *
    $ k: G' m# i. p
  15. * This program is free software; you can redistribute it and/or
    6 G8 K3 c: X) d. q  d2 g
  16. * modify it under the terms of the GNU General Public License as2 A, K7 w8 H" I# X- I5 l) h
  17. * published by the Free Software Foundation version 2.2 q0 h4 ]' |) h, K5 @+ x
  18. *0 i2 k; w; t% H+ y" q5 l. p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Q/ F. E# T8 i0 n& n) F+ V
  20. * kind, whether express or implied; without even the implied warranty- ]9 }$ X; l% ]2 r" X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; o+ |5 q1 @) L
  22. * GNU General Public License for more details.3 a+ `8 o8 {" `" E5 c
  23. */
    $ \/ x+ l; G, z1 _' M" `  {; n, S
  24. 0 H" B& t9 A$ U6 J  ]) G) z
  25. #include <linux/module.h>
    - b% ?4 x1 h2 q, I5 _
  26. #include <linux/init.h>$ X/ ~7 @# j0 d+ @
  27. #include <linux/errno.h>9 C# B; m8 ~# H" \! F/ W
  28. #include <linux/types.h>% t6 I' r4 M  o. K1 }
  29. #include <linux/interrupt.h>
    " V( }% x% b; w9 Q! y9 S
  30. #include <asm/io.h>8 V( ^2 g3 W" p, [
  31. #include <linux/moduleparam.h>7 k" f9 g# W& n% S
  32. #include <linux/sysctl.h>' j, n% U/ w! ]2 p5 A6 c
  33. #include <linux/mm.h>; \$ [  B3 H: {( Y' M
  34. #include <linux/dma-mapping.h>
    - R% I) \. u5 h
  35. ' ]  E# j3 A( K' G9 d' A
  36. #include <mach/memory.h>
    ' m3 c- v) ^+ ]3 Z" h5 X& }
  37. #include <mach/hardware.h>' Y1 D8 G% L$ [0 M0 y; H
  38. #include <mach/irqs.h>' a% e! o* o" \. m
  39. #include <asm/hardware/edma.h>3 |! `  _( @1 h0 ?5 M/ I
  40. ! d' ]1 N* s- C7 E2 \- D
  41. #undef EDMA3_DEBUG/ M& l  A  k7 r7 }( a) r" M
  42. /*#define EDMA3_DEBUG*/1 L. v& A- H' U. P

  43. : j2 r/ L6 b$ W9 e* C- @  D
  44. #ifdef EDMA3_DEBUG. U9 {, \1 H9 M8 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" F4 P: v5 c4 O/ Z8 ]$ W2 b, S! H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; A: X- `9 f! M. ^2 [( U$ z2 k5 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! l# s6 I) \/ @/ \2 `! [& `
  48. #else
    ! g6 ?  H& @/ O% m) O" o
  49. #define DMA_PRINTK( x... )& {  o; G  X$ z
  50. #define DMA_FN_IN
    % p; ^) n2 b; w/ M
  51. #define DMA_FN_OUT
    ! w, ]  ~2 ]  T4 ~8 }3 T8 N
  52. #endif8 ~4 X8 y3 c+ D, K

  53. 0 `$ Q  S  S/ R+ K7 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ i% ~. j. ?6 y% x3 r4 V7 \
  55. #define STATIC_SHIFT                3
    " T! }& K& ?+ n, Q6 T/ H1 A
  56. #define TCINTEN_SHIFT               200 B5 h2 F+ W, e3 |) ]1 j1 G. W
  57. #define ITCINTEN_SHIFT              21
    8 m! }" y, j( R. ~. w# w
  58. #define TCCHEN_SHIFT                22
    ( q, h( T0 |1 }! X2 e+ Y7 ^* N
  59. #define ITCCHEN_SHIFT               23  }; r4 u" g- h4 {5 `, [3 ~6 u; g
  60. 0 M; e8 z' P/ V# r' T
  61. static volatile int irqraised1 = 0;( [7 d/ k- _6 w4 \3 S
  62. static volatile int irqraised2 = 0;0 h! P2 O( j' J- n- A
  63. 0 f6 f- z* W" e( U7 J7 N# {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; z9 Z" q, n0 X% l; w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Y5 O0 P) `7 e& r9 C* c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 L+ j% e1 P1 U% J
  67. 7 P: S2 E6 h+ B% Y7 A
  68. dma_addr_t dmaphyssrc1 = 0;
    , F- p& L* i5 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    " e7 j  Z3 `% F8 E. R1 J# E
  70. dma_addr_t dmaphysdest1 = 0;
    # p: t* I& d6 ]( h+ x& u3 L4 t
  71. dma_addr_t dmaphysdest2 = 0;$ n/ B' O3 F0 h, h1 S: {2 Q8 z
  72.   O: u, W) Z* Z# q0 F
  73. char *dmabufsrc1 = NULL;
      d  ]% p* M' P$ E$ o4 a9 `. u* s
  74. char *dmabufsrc2 = NULL;
    , ~5 x' b9 S* \& g) l& E. G
  75. char *dmabufdest1 = NULL;3 n( x1 a& s' B8 W
  76. char *dmabufdest2 = NULL;
    7 g  C' o* T8 w- _
  77. - Y( Z6 ?! R9 G# E
  78. static int acnt = 512;- _3 r: s7 a' f; O5 t: W, N
  79. static int bcnt = 8;0 ~9 g( g2 }, E( l$ z* o+ x
  80. static int ccnt = 8;
    9 i" b0 a4 T# `
  81. : n, s# I7 C2 C# E* k. d
  82. module_param(acnt, int, S_IRUGO);
    ; j) j, r5 W8 q4 a
  83. module_param(bcnt, int, S_IRUGO);
    / _5 m$ r1 F% q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: g( {8 v+ c% Z. j  k  Y9 W
7 @" L/ p- h9 R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( n. u+ E" ]( H6 P, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' m- N' r! W# ~5 m1 k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; t" s+ R. k+ L/ {  e
$ g3 g. U1 X7 D& y* J0 n" a  y: z4 B  B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 16:18 , Processed in 0.039374 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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