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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 K! \0 |) Z" M* ?( ^
  1. [code]EDMA sample test application! t5 ?6 X( R: Q5 x
  2. /*
    . z0 p5 p% ~5 U5 F
  3. * edma_test.c
    ) L; D0 @7 X8 D& p7 v/ j6 W
  4. *
    1 y1 j( k' J( N* r
  5. * brief  EDMA3 Test Application7 }7 h8 q' b0 _) ~9 m+ d
  6. *4 N7 e, G+ H3 D
  7. *   This file contains EDMA3 Test code.
    6 c) ?/ V" C$ f) E  Z
  8. *
    & v# `  K4 B, a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " X! }* z# q8 ~$ {" c* q; M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 r3 \* J* r; t' P9 Y" T* O7 Y
  11. *         TO CHANGE.0 m0 n4 c' ?" ?$ a: r' r; o" B
  12. *" y! G2 k" r, h8 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 V2 Q: I1 I4 r) P4 j
  14. *
    ' f7 A* K' S' T7 ~& [
  15. * This program is free software; you can redistribute it and/or
    ; ]) u+ V4 B, B( g' _
  16. * modify it under the terms of the GNU General Public License as6 K' {% e. J& x9 E1 W- \2 _* K" X
  17. * published by the Free Software Foundation version 2., E) G$ W9 _' O) u: ?
  18. *' J9 w" |- B# i- E) W$ \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 H. r: i; V: L' m5 D7 `2 g5 A
  20. * kind, whether express or implied; without even the implied warranty8 M1 v+ \: B% U  M$ y1 H( D% L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. G# p5 q5 u2 Q( n
  22. * GNU General Public License for more details." q! j7 n6 t. @/ D; u' \7 M
  23. */
    ( e- B+ n  U, I7 w6 E3 [- A

  24. . N1 I- _2 D9 i  \/ n, E* n2 N+ k* D
  25. #include <linux/module.h>
    ( n! H7 Q8 C* L! y- [/ h% V4 J
  26. #include <linux/init.h>8 V. D4 g2 g! \! H7 \* y! e: l
  27. #include <linux/errno.h>; \3 L) D6 k2 J% K4 H
  28. #include <linux/types.h>
    4 y" u* C- {' @. H& s/ \, P
  29. #include <linux/interrupt.h>5 U1 `, o" b. e( E$ a- M* N3 P
  30. #include <asm/io.h>
    6 S5 O5 P7 k" n0 f3 y1 m  [
  31. #include <linux/moduleparam.h>
    / Z$ _0 q4 }" L9 y
  32. #include <linux/sysctl.h>" t, x& {2 h& a& c
  33. #include <linux/mm.h>
    7 Y! M9 Z5 r* j8 Y" s
  34. #include <linux/dma-mapping.h>0 O. j, [  g- b) {

  35. : ?: {* o# S3 c
  36. #include <mach/memory.h>7 ~! B' f4 g/ t3 x9 `+ P
  37. #include <mach/hardware.h>- n! h7 U7 q% Q+ d. {; A$ @; E
  38. #include <mach/irqs.h>0 J+ G- Q( _' M5 S4 a1 q( N1 n8 v
  39. #include <asm/hardware/edma.h>1 W: g) U9 Q6 b7 @0 C: N
  40. * O3 r6 I8 }8 e( X
  41. #undef EDMA3_DEBUG- G% F& T* M/ z, @" M
  42. /*#define EDMA3_DEBUG*/
    8 u) a7 \* A% G
  43. - f: {, t- I2 d
  44. #ifdef EDMA3_DEBUG& O, {9 P* v: \6 `" B, L  v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; f" K; Q! J& t" e6 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , N  O: f( z% L8 A. y- e3 F& d5 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 R% W- l* k6 c0 Z/ t$ ~! l
  48. #else% Z: ]' v9 M, j3 U
  49. #define DMA_PRINTK( x... )
    ! x9 h2 _' U: x9 }1 E
  50. #define DMA_FN_IN( p( F8 Y5 n7 x$ V8 Y6 H: y
  51. #define DMA_FN_OUT
    ( L# h/ r. n& q5 I
  52. #endif- j" m6 i  [! _6 @: O* K# Y6 n% T

  53. 7 i( {  P. q: y, v5 _4 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 q7 a. ^5 w$ w/ G: F  c& c
  55. #define STATIC_SHIFT                3
    0 F6 M' u+ P% \$ ?! ^
  56. #define TCINTEN_SHIFT               20( D: ~! a+ d/ M. r
  57. #define ITCINTEN_SHIFT              21
    # B% d# K3 Z+ I; V$ _1 |) @
  58. #define TCCHEN_SHIFT                22; c6 I  w: d4 F) d9 {5 a' H
  59. #define ITCCHEN_SHIFT               23
    % q: M, f7 W! Y4 r

  60. ) i' ~' K. e; T7 X
  61. static volatile int irqraised1 = 0;9 _8 K# n. R# q
  62. static volatile int irqraised2 = 0;' c* |  {3 @) Q0 e

  63. 8 y; N/ X$ T. X6 R$ d) A9 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ]" d4 P( A1 u% ?) a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, x% f' K. P) J) O( ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. G4 x' H" A- O2 g7 T& w( l+ g

  67. * x8 _9 }$ `  o- g, a
  68. dma_addr_t dmaphyssrc1 = 0;
    4 l# d! t! R$ B/ Y, ^  r9 E
  69. dma_addr_t dmaphyssrc2 = 0;
    + b$ y0 n+ o: y- K
  70. dma_addr_t dmaphysdest1 = 0;
    . V0 P+ w3 g- b& B
  71. dma_addr_t dmaphysdest2 = 0;
    ; V9 z. z9 b1 S/ T4 B9 V& b
  72. ; j  i  B$ P( d4 Q
  73. char *dmabufsrc1 = NULL;
    : q% Z7 B5 x# ]- f, v* m: ~
  74. char *dmabufsrc2 = NULL;
    4 B! A# `) C8 E) G
  75. char *dmabufdest1 = NULL;
    , ?  ~- h2 k9 Y2 N, r2 J
  76. char *dmabufdest2 = NULL;. T) N2 C  p) \4 U% e

  77. 1 Z: i6 H4 p+ C: ?
  78. static int acnt = 512;
    8 _* q- ?( y2 E4 S1 v
  79. static int bcnt = 8;& ?) Q6 C7 {% [6 m0 L
  80. static int ccnt = 8;
    * K1 T6 \1 z# s, ^. T* u% _* O6 @
  81.   O6 \2 g' L4 t$ X
  82. module_param(acnt, int, S_IRUGO);0 ^; N% ?  j: r2 S( p; h+ o
  83. module_param(bcnt, int, S_IRUGO);7 N% A, `1 f6 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, g! J$ R1 z* r+ M) @+ `
% u: {, E* N* |" w) v5 L8 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! }5 E# W) K( ?. R  x) b. n7 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% k: t- e8 g5 b4 r2 T+ q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) S6 j3 A! r0 u: X

7 Q% _1 e9 h4 P, B$ d! k4 _( x
0 C# n9 ]. x2 I/ q- I" g$ q5 F  C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-4 05:24 , Processed in 0.045599 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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