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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ?* y4 E& f! |* l" \1 E7 S
  1. [code]EDMA sample test application
    6 V/ t0 [5 C) E7 o  |6 I
  2. /*
    9 U, I8 B" u1 i
  3. * edma_test.c
    5 w" C+ o) n1 }( E% |
  4. *9 w, g0 z0 I* j, D4 \
  5. * brief  EDMA3 Test Application9 Z! c5 c! F& P: g! q) s
  6. *
    ! \# a6 x& D( Q2 Q% K
  7. *   This file contains EDMA3 Test code.8 G3 K. i  O2 G# h2 V+ s7 X% G
  8. *2 B0 _' ^2 r! _3 `# Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  E* j% a$ S3 Y+ L6 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % |, A0 @, N0 J
  11. *         TO CHANGE.3 O) v: N# i& s9 y  E3 r
  12. *
    8 c: z; \# I& R+ d4 n; l5 ?1 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) {* y6 W; {( ~/ a! t) C
  14. *
    ! j" u- @  D/ @; B9 ~2 S
  15. * This program is free software; you can redistribute it and/or
    % ?, ~' l9 ?: u- X
  16. * modify it under the terms of the GNU General Public License as
    , }7 k' u; r3 Y- n8 I
  17. * published by the Free Software Foundation version 2.
    7 k( w0 s, |# i
  18. *
    , L- c! m5 H+ G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 R) E# G; D8 W" g/ w
  20. * kind, whether express or implied; without even the implied warranty: x9 _1 H% n1 g, Y' A+ D# X9 |+ C0 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 n5 F2 a/ \9 a- H! W! X5 a
  22. * GNU General Public License for more details.! J2 n! Q6 @; e7 T+ O. T" g2 q
  23. */- D6 \7 h4 [  J
  24. ' l1 p: X* F+ P0 W8 E
  25. #include <linux/module.h>
    $ `1 T2 }2 c4 Q2 a: Q
  26. #include <linux/init.h>
    * C: _7 @) d, K, j7 `
  27. #include <linux/errno.h>
    1 `, \7 E2 H8 W; g9 ^" s; ^
  28. #include <linux/types.h>0 i- O, P; a) L- O) ^; o5 M+ X- V6 M
  29. #include <linux/interrupt.h>% r4 ]: c* ]9 t& Y( }
  30. #include <asm/io.h>0 d) \+ Y& P9 z" E9 U7 j7 e
  31. #include <linux/moduleparam.h>0 b1 g. Y( m- Z; q( ]; q& g' I
  32. #include <linux/sysctl.h>
    " H" f$ s  ]& L4 e( b, Z
  33. #include <linux/mm.h>
    9 n6 J/ T, s' k: w! K; Q' [
  34. #include <linux/dma-mapping.h>6 X. q1 D2 `- Z/ X7 x

  35. ! t4 g7 m: T. W- Q
  36. #include <mach/memory.h>- y2 |3 R2 q! N! p/ z' P& k, R9 N
  37. #include <mach/hardware.h>
    7 j  |7 B  W( `$ ~) s1 [: b
  38. #include <mach/irqs.h>
    1 \$ {: V* U0 R+ X3 v- ~
  39. #include <asm/hardware/edma.h>
    " f: T. P2 |4 |
  40. 2 W+ P& W3 }9 B8 \, [% R% b
  41. #undef EDMA3_DEBUG! z+ z3 W" m' P! x7 a
  42. /*#define EDMA3_DEBUG*/
    6 o: v+ M; e1 ~5 f8 [! q

  43. ' @- G* }6 u" Q# T
  44. #ifdef EDMA3_DEBUG
    4 u0 P( n. ]1 n0 v% S3 k4 V$ S6 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); M1 V. b; c0 b6 E4 V  I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' C5 M4 W8 Z9 b0 F& T2 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); s0 H3 i8 U& e9 x+ J% ^  K$ }: r- i
  48. #else
    ( U6 t, p5 @1 Q5 D1 m/ |
  49. #define DMA_PRINTK( x... )$ D. I+ B4 ?# q6 o& h
  50. #define DMA_FN_IN; c( `1 u& v. C9 K: t2 n( y
  51. #define DMA_FN_OUT; `) k( g$ q1 D% n1 \- s3 P
  52. #endif+ l, Q7 R: D2 ~: n5 R1 w$ `

  53. 5 k" S! Z/ m0 C2 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ G0 Z4 B- T8 K; H
  55. #define STATIC_SHIFT                3: ?9 m+ }& k8 V7 n$ n
  56. #define TCINTEN_SHIFT               20
    ' _  F: s1 y+ t' `8 N( M; F
  57. #define ITCINTEN_SHIFT              21# Q" q1 l0 h& h1 u( [
  58. #define TCCHEN_SHIFT                22
    ! B) i0 u9 v4 i$ x8 g' q
  59. #define ITCCHEN_SHIFT               23
    7 I2 V9 i+ E( ^" V

  60. + k# h( Q3 R- j9 e9 x
  61. static volatile int irqraised1 = 0;
    . j1 n; z4 ~% v5 n+ f
  62. static volatile int irqraised2 = 0;* Y' J/ t0 t& D+ U# o# C( R! J

  63. - x" T% j2 P4 i) D8 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! {* E; W6 @3 U/ L1 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( R; R3 L2 B# r0 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l1 ^- {8 E& P6 m6 h, F- p

  67. : F5 [, n  X; m2 {: n8 j4 T
  68. dma_addr_t dmaphyssrc1 = 0;9 [# v  X- L6 W! G1 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    1 e. x# s/ m3 ~& ~% j1 Y
  70. dma_addr_t dmaphysdest1 = 0;* @+ G  w* X( N3 I
  71. dma_addr_t dmaphysdest2 = 0;: a+ t1 m, d3 \; _# s# W6 }& c- b

  72. - g* }/ R, e& o( t" y
  73. char *dmabufsrc1 = NULL;% a- N$ H/ w8 H9 l# `
  74. char *dmabufsrc2 = NULL;
    - l4 K, V( P/ ]2 Y/ \6 ?' ^
  75. char *dmabufdest1 = NULL;; D6 v$ V& W& q) \) O2 m
  76. char *dmabufdest2 = NULL;' D6 j; O8 `  ?6 J- Y9 T! C7 O) O8 G
  77.   V: h+ J* x, H2 Q& a# O! \
  78. static int acnt = 512;
    4 r( Y: X1 E/ [' _
  79. static int bcnt = 8;
    ; B7 b5 p8 b% }7 ^( Y! W, p1 c
  80. static int ccnt = 8;! j, `: g5 k4 h
  81. ) U: Z' P. u+ q+ Z- W
  82. module_param(acnt, int, S_IRUGO);
    3 h. d4 D0 D( ~2 u4 O( Y2 J  F1 ~: F- T
  83. module_param(bcnt, int, S_IRUGO);; i, v5 \$ Z9 \" q, j8 A2 t5 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' c* }( I/ f; G# _) r

8 K* T/ o$ a$ i, I, s8 \8 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% h; ?, j# C$ a$ A9 J) t5 e2 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' I) T0 Z+ v* r$ m$ l* d% C( v8 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- N5 x$ e5 j5 X4 A

1 H0 P& Q, _8 \0 G! |# d
7 L0 t+ Q' ^- D7 `. q: K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 10:20 , Processed in 0.040627 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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