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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 i" u( }# e( r' n
  1. [code]EDMA sample test application
    9 Q1 d8 ~$ N& |  Z* t
  2. /*
    8 w0 F! `+ P0 W" i8 C. O' `. L( Q
  3. * edma_test.c  h4 ]  L9 l  t6 _" a
  4. *8 K% E: H- s: C
  5. * brief  EDMA3 Test Application( I& \6 v* a& M- N
  6. *  C7 n; y/ t/ O1 y' S
  7. *   This file contains EDMA3 Test code.+ m% a8 t  e& N$ H, M$ X' p+ }* ~- E# ]
  8. *# s* ]1 b% {; X; I- o8 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / E& i  h3 S: ^/ w7 `0 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ t+ `8 a1 l$ [5 [5 @% X3 r
  11. *         TO CHANGE.$ v; D  w6 y3 c! u/ J4 q  H$ K
  12. *
    , k" o1 K9 A8 P! h3 y* S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( g& ]& p+ U  M; O* y
  14. *2 V: y. h( }' j( D2 _
  15. * This program is free software; you can redistribute it and/or
      T; P1 j: {* ]# F5 H- [
  16. * modify it under the terms of the GNU General Public License as3 M) J9 @: @" }  l0 E  u& ^2 }* O3 k
  17. * published by the Free Software Foundation version 2.
    $ A" i3 N, D. u
  18. *
    % m- `1 W- Q) d3 E) q, G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* w% o7 A& @- f* O3 J6 `' T& {
  20. * kind, whether express or implied; without even the implied warranty
    4 v! H: Q# X/ G( x& W- b, D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! I9 M% m$ g$ w3 t; {/ B- ]  l
  22. * GNU General Public License for more details./ i0 j6 e, M1 Z8 G  [
  23. */
    1 @9 Q1 x0 v: U; R* e

  24. 4 f. c! R2 g9 b. Y8 D3 _9 B
  25. #include <linux/module.h>
    4 E$ n  K+ D0 F  b( l; `. A4 x
  26. #include <linux/init.h>+ Z5 f6 k: X$ L% ^% d* G
  27. #include <linux/errno.h>& e/ U& G  f: S0 X
  28. #include <linux/types.h>% L. j( J$ R+ E  b
  29. #include <linux/interrupt.h>+ j6 O5 C8 k9 B
  30. #include <asm/io.h>
    3 r+ P3 [' d; S* X$ d* s
  31. #include <linux/moduleparam.h>
    " e& D$ `( b* D, i
  32. #include <linux/sysctl.h>
    , A. `2 R4 A' V. s. M6 o  n
  33. #include <linux/mm.h>
    % K/ H2 A! e" z5 G& \" X. k/ m
  34. #include <linux/dma-mapping.h>+ [. `4 [1 x0 b8 z% w6 c2 I% C! h
  35. - {0 w7 d( c, S
  36. #include <mach/memory.h>5 H4 t" m1 U# H) @! n
  37. #include <mach/hardware.h>
    ' f8 K1 c1 A3 w: }' A0 p3 T4 q6 N
  38. #include <mach/irqs.h>
    % b" H" N- I: b/ _5 b4 h4 c
  39. #include <asm/hardware/edma.h>
    - e+ `% L% s* p5 C- @/ M

  40. 5 f7 ^9 t7 q" U& H
  41. #undef EDMA3_DEBUG
    ! R  q' T9 o+ c' J7 A
  42. /*#define EDMA3_DEBUG*/6 B+ V; _) c1 T

  43. 5 ~% w* o# J+ S5 f7 [/ U7 z5 T
  44. #ifdef EDMA3_DEBUG3 w! ^( J4 z* I9 O1 @9 |+ g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* H2 q/ f) x! v) i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 I( E/ U: _. V; t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 }5 \9 x$ y* U! ?: t+ S9 I
  48. #else; t, P! F6 r' d5 P; e
  49. #define DMA_PRINTK( x... )
    9 s0 R4 N, a( F/ r
  50. #define DMA_FN_IN
    * ?4 Z5 m! `" X1 P' q
  51. #define DMA_FN_OUT
    ' s. w3 X# Z0 X5 ]
  52. #endif
    1 J) S; [. E0 \# ?; E# l

  53. " G# `4 _. e# j1 W1 v+ E0 [( h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- j( w; B4 I( W) A
  55. #define STATIC_SHIFT                3
    , K9 w) S. L) ~; x( L# u
  56. #define TCINTEN_SHIFT               20
    $ j$ o1 f' K) {3 ^0 b3 O
  57. #define ITCINTEN_SHIFT              21
    / G% ?* `% B9 S8 x3 G" o
  58. #define TCCHEN_SHIFT                22
    # Q$ E8 f. P% E, E! P) _
  59. #define ITCCHEN_SHIFT               23
    * z5 ]; _$ s# H4 n6 l

  60. ) M6 H& O" {: u7 M4 o- N! h
  61. static volatile int irqraised1 = 0;: N! e' V9 P3 |  ]# E, u
  62. static volatile int irqraised2 = 0;
    " j7 e' M7 n$ A8 _9 v

  63. + X5 x9 s, X4 Y; V- l9 f8 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- f- e9 x  \) D% \0 Z4 H9 M* m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( C) ?. Y2 s3 H) |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : \  Y9 E6 _3 ^& c* n6 O# {1 ?
  67. , i+ E) O& m) s7 g
  68. dma_addr_t dmaphyssrc1 = 0;" `  R9 D" J3 n- `& }
  69. dma_addr_t dmaphyssrc2 = 0;
    - n. A: z. E  h9 H. [  h" v4 O
  70. dma_addr_t dmaphysdest1 = 0;
    7 H2 B+ }) J) v& [% X) b
  71. dma_addr_t dmaphysdest2 = 0;
    - R$ ^( e! c" L; |8 v
  72. * `+ c% [& A: w$ \
  73. char *dmabufsrc1 = NULL;
    % N+ r1 B* R( D4 A, C
  74. char *dmabufsrc2 = NULL;- @, ]% j8 s6 {6 \
  75. char *dmabufdest1 = NULL;" F, q8 Q6 i/ `$ \
  76. char *dmabufdest2 = NULL;% _2 t! s" T+ Z' Y" l8 l
  77. 1 f3 A+ d8 h- r7 o& o
  78. static int acnt = 512;$ `( a' u- s: H9 @2 D  `
  79. static int bcnt = 8;
    : A( b! T, M; h  B* G. P, g
  80. static int ccnt = 8;
    % _" n9 C7 Y0 Z8 o  J

  81. * K: @- k3 X  f7 r4 Y! ^# \
  82. module_param(acnt, int, S_IRUGO);4 `5 T6 y. J8 T$ U  [" {
  83. module_param(bcnt, int, S_IRUGO);0 F; U$ R# W& @* y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: y% ~; B4 J& y6 O7 l

; ~  O) L! {+ @3 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ @& a1 |% x' Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: Z( B- j# B/ q& d, F; p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ `5 j, Q/ X2 `1 X" ], j
7 u: {5 i& `7 M% a5 S
2 Z6 ~' M. N2 [* E" h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 16:59 , Processed in 0.043425 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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