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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 W/ _4 D6 k0 _9 a  {( d
  1. [code]EDMA sample test application  H& W! \: n/ v7 P# P" ^1 P
  2. /*/ m6 t& j7 G9 e! i) C* X
  3. * edma_test.c
    0 J7 o/ o. r3 j% p, Y
  4. *% b  R( Z" i* d+ l3 }8 o+ l
  5. * brief  EDMA3 Test Application
    , R: N  v+ n: w5 c3 y- R
  6. *
    5 k: ~% S! A7 I5 L% @6 w; m/ i
  7. *   This file contains EDMA3 Test code.
    6 \+ B0 H% O& |" \
  8. ** j  j/ Z. Y; M; H+ F7 }) I. g3 h- q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " F1 V3 e- M; g" y% m* Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 G) R0 X; D/ e/ r% n% U( G; N  w
  11. *         TO CHANGE.
    8 r+ n- R: y# m9 M  ~, V# `9 z
  12. *
    . b* a6 G5 G4 k5 p, u1 A' Q, O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 L5 M8 v. C9 Z, a+ g) @7 S
  14. *$ E- l' u. S5 t: I# b9 t. N
  15. * This program is free software; you can redistribute it and/or
      ]) v) B$ U8 U/ g, `
  16. * modify it under the terms of the GNU General Public License as
    ) r! _5 |/ D. W: N- a. n) o$ r% }& M
  17. * published by the Free Software Foundation version 2.
    " e3 K- Y1 b* C
  18. *. W& h: w7 ~+ R+ r) r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* P* y9 V+ w+ i6 m
  20. * kind, whether express or implied; without even the implied warranty
    ) N4 f" ?' F+ e; T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 \; ^/ s2 m! _7 c$ i; f
  22. * GNU General Public License for more details.
    / `+ F; z# [+ v5 Q! t2 G
  23. */
    / X; v6 Z+ X) k, ^* x

  24. / Y) D1 Z7 A5 c6 m9 v* F( O
  25. #include <linux/module.h>
    : d9 L1 P; `% g$ Y  e8 M  Z
  26. #include <linux/init.h>/ p: n/ j2 v" M* ?
  27. #include <linux/errno.h>- G1 s& `1 y- N& H" N4 c$ O
  28. #include <linux/types.h>
    ; j" ]( D2 C' P( L0 V
  29. #include <linux/interrupt.h>
    $ \6 U2 a' n+ l# Q% w& }) v
  30. #include <asm/io.h>; F0 X8 H, P+ q
  31. #include <linux/moduleparam.h>! {7 P7 p9 @7 o1 @# \/ J! z  \
  32. #include <linux/sysctl.h>" S% }: J5 h: X: {' @: |: l
  33. #include <linux/mm.h>; U& p7 E  s, z9 f
  34. #include <linux/dma-mapping.h>: x% G) B/ r$ {. C1 _: ^

  35. 3 m2 l7 w& U' ]
  36. #include <mach/memory.h>
    ( k/ a/ y! \& L0 t0 o
  37. #include <mach/hardware.h>
    # y$ U) a. u  C" T4 U* \4 b
  38. #include <mach/irqs.h>5 ^5 n- X- e0 K) _7 Z4 O
  39. #include <asm/hardware/edma.h>
    ( K2 Z+ n0 x- C
  40. , j% ]7 o  u- c6 |% T4 C
  41. #undef EDMA3_DEBUG- x( `4 L$ z) q5 k% g4 ?
  42. /*#define EDMA3_DEBUG*/: |: j  J# c' g. Y/ `

  43. ' U* B  H1 f& j0 r7 l6 R; k+ M
  44. #ifdef EDMA3_DEBUG
    # v4 v9 N. y- u' E' g* Z( M% [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 p: I7 y& v/ f3 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & K( E3 P' @. W; P$ Z* }/ j& p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) t+ j2 B4 H0 `
  48. #else' L  C+ J: i: i
  49. #define DMA_PRINTK( x... )4 [' X! p% L  `* ?4 H& V
  50. #define DMA_FN_IN( d6 v: _, o# f% D( S3 n9 b' K
  51. #define DMA_FN_OUT
    5 V$ g& X: F7 M) U% z
  52. #endif4 o; D; W2 E8 y$ m9 e% ?- N
  53. $ x" b9 w! C- c! G; |7 A: |* z4 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 u' L8 t! h- Z: w
  55. #define STATIC_SHIFT                3" f9 J8 [$ S! Z* F
  56. #define TCINTEN_SHIFT               20
    ( l6 p( O/ E1 \7 O6 u! ?
  57. #define ITCINTEN_SHIFT              21$ F& Y: k8 F( C4 D+ g# T1 o
  58. #define TCCHEN_SHIFT                22
    3 ~! W. k% a4 y* p' C
  59. #define ITCCHEN_SHIFT               23' y6 ?8 w7 a) n9 P" q
  60.   M: n& z" E( p/ I; ]
  61. static volatile int irqraised1 = 0;, r7 @3 H+ B0 C
  62. static volatile int irqraised2 = 0;
    & y% @- `" X- S3 o& F- H
  63. % Y- K0 a) Q! w# Z. o* x, }, c+ i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t4 E% n) ~9 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ]: Z2 r: f8 y# A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" J  g, E& c5 o7 |5 x" E
  67. ' W, E1 |% e- y' _; \. M. j
  68. dma_addr_t dmaphyssrc1 = 0;
    1 X' R+ Q$ n  l
  69. dma_addr_t dmaphyssrc2 = 0;1 }8 W1 O! A: T! U4 g
  70. dma_addr_t dmaphysdest1 = 0;
    - x3 J- s+ s8 N; w: W
  71. dma_addr_t dmaphysdest2 = 0;
    " z, L, j0 U, E# ?
  72. - A7 A1 {" ?' ]8 |7 D1 a
  73. char *dmabufsrc1 = NULL;
    ; g# ]0 _' M; B2 i+ q
  74. char *dmabufsrc2 = NULL;
    8 j5 Q& R! K& w0 \* c  a) M
  75. char *dmabufdest1 = NULL;5 J, N) X, E2 ?: b" j8 F
  76. char *dmabufdest2 = NULL;2 f+ K$ K; f7 d

  77. ( Z" o9 `  m, d; h" N) \1 _
  78. static int acnt = 512;
    , k7 a# O. Y" y2 ^
  79. static int bcnt = 8;
    # C4 [* i% ?! l9 @6 v/ n# {, T
  80. static int ccnt = 8;
    5 O% m, }" r0 l' A
  81. - y4 l! m: t1 n/ v( \8 \
  82. module_param(acnt, int, S_IRUGO);2 D: l" J) J- I6 |1 r
  83. module_param(bcnt, int, S_IRUGO);/ `  c2 }8 A7 k( i2 \* W: i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% d, E- i- r: g8 o7 B

" X! I' e  ~3 }) y2 O. b3 m4 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( Z( Z1 z6 ^, Q( Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 C: ]! {: U* J; Y* u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 q% K& {4 T8 U$ \, B4 [% n+ E- [& P4 @! u3 k+ e6 a1 G" I

% `( H3 A: e% R. a/ a: s  s! v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 22:30 , Processed in 0.041271 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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