OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( L, C: _' c! S6 F, Q& V
  1. [code]EDMA sample test application
    : \6 G3 H6 O  \
  2. /*) [: g9 n! i7 D. g: U* ]% M& J
  3. * edma_test.c7 f" [6 ~+ {4 X2 @9 E
  4. *
    , b4 @+ W9 z, B8 a* g6 @
  5. * brief  EDMA3 Test Application% Q  v9 b9 t7 q
  6. *
    8 {) w3 q9 P- M# n; @
  7. *   This file contains EDMA3 Test code.
    * c, y- ?" C: F% h4 a, U5 x- D+ n4 u
  8. *
    " m, ^& h1 r: z; O2 b6 k) `8 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 r' g( v/ [0 f4 l2 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) R. k" k8 [. b% o! u% M" G
  11. *         TO CHANGE.
    . I2 o' N" N) L" R2 q9 g8 l
  12. */ O7 o' x$ n/ @0 Y, ^: j$ S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 t7 h8 C( |/ U7 Q- o
  14. *
    % {3 V, y# F- }0 K
  15. * This program is free software; you can redistribute it and/or3 k1 M$ }" A/ V9 J
  16. * modify it under the terms of the GNU General Public License as
    ) D$ Y& g# z) E! V
  17. * published by the Free Software Foundation version 2.
    ! p6 E/ U( d; N: X+ v( L" S, \, G
  18. *
    % z, ~0 {2 _$ E! X8 [3 j# G! j/ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 u8 X; g" E- j1 m3 m! l2 V1 X
  20. * kind, whether express or implied; without even the implied warranty
    $ b0 }( U; M2 `% \. w' e0 S1 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! x& G% X" s; a. @- T: x: w# |9 m- S
  22. * GNU General Public License for more details.5 s9 c1 V% q: X, l6 l
  23. */" e9 _3 Y2 ~7 ~6 A6 h* o

  24. 5 n" N' x: T+ P9 L" P. M
  25. #include <linux/module.h>6 E0 L, x# g6 \' }
  26. #include <linux/init.h>
    * m3 H* Q4 k, E! B
  27. #include <linux/errno.h>, I5 p, O; d$ t4 ^8 ~) ?
  28. #include <linux/types.h>
    ! S5 A6 S& |7 q
  29. #include <linux/interrupt.h>
    ( ^' p' F" Z) F; b
  30. #include <asm/io.h>0 W7 A& V5 @6 T5 G7 Y6 o  W
  31. #include <linux/moduleparam.h>
    ( B# d# k6 s# L8 R, }4 c) h
  32. #include <linux/sysctl.h>
    $ x: B) _& ^- ^5 ?/ J) H8 t- S# I
  33. #include <linux/mm.h>
    . j' h6 X1 I$ H4 ~" H8 G
  34. #include <linux/dma-mapping.h>
    * r, k, h4 N; U+ M' K

  35. # l2 x4 g* p+ n) J* e& N' k* g
  36. #include <mach/memory.h>% N5 K1 F; _! P- T; E
  37. #include <mach/hardware.h>
    4 a; |  w8 F$ X; J/ h7 z/ c0 P
  38. #include <mach/irqs.h>
    : X1 J$ w' Z6 K7 F9 j. C
  39. #include <asm/hardware/edma.h>
    $ P$ |6 b6 r* z+ N  A& {. U

  40. & Q4 `# E/ A6 d0 ?: w% @* E2 f
  41. #undef EDMA3_DEBUG
    , E* w6 o! o, N  [
  42. /*#define EDMA3_DEBUG*/
    1 o$ G& Y' {: W$ [; v. }( v

  43. ) E# ^9 M( s4 G; v2 l0 L5 B. x
  44. #ifdef EDMA3_DEBUG9 P2 t& ]& x: ^: ?! Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ N  A; H6 f/ g0 s6 o; o5 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' W0 p( h. g: E8 f" c) `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! J' V: v8 Y/ _' B1 [
  48. #else
    $ Q  g$ U  |) W6 K8 M
  49. #define DMA_PRINTK( x... ); N/ b. m* k$ C! E2 B6 B
  50. #define DMA_FN_IN
    0 B3 i) n/ y# r- s! [! n
  51. #define DMA_FN_OUT
    . z/ d8 A) P6 E$ R
  52. #endif" Y" r, Z& F0 s" {( \! w; o4 j; w

  53. 9 @& K0 ?: T( g, C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). A1 C6 d3 `3 V
  55. #define STATIC_SHIFT                3
    # A% [2 T# z# F
  56. #define TCINTEN_SHIFT               20* `0 n0 `  F+ V; h+ T9 `
  57. #define ITCINTEN_SHIFT              21
    / j, Q4 t8 b' F. t: C" v) g+ ~. J
  58. #define TCCHEN_SHIFT                22% o4 Z: O( T/ n+ |. m0 n8 B
  59. #define ITCCHEN_SHIFT               23# s  s! c: a5 ]" K3 `8 D' b% F  j$ i
  60. ' _7 D+ l1 s! Y
  61. static volatile int irqraised1 = 0;
    - ]- u0 j& X6 G/ w8 P! _
  62. static volatile int irqraised2 = 0;
    2 r3 P- A; r& F8 v% D4 v- f4 f/ t+ ^
  63. # Q1 H8 }" ]/ {: E6 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* d  k+ |) N4 d5 s0 ^1 P! w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 y6 R, X0 Q" W) _+ b/ E8 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + s% p; Y( Y8 R1 [% T

  67. ' o# l5 o' N# |7 J5 _* i
  68. dma_addr_t dmaphyssrc1 = 0;: a+ }% j9 `- H" Z. s0 {
  69. dma_addr_t dmaphyssrc2 = 0;( E  b; E) {* @: Y
  70. dma_addr_t dmaphysdest1 = 0;# g) r. N5 Q$ ~7 V$ L
  71. dma_addr_t dmaphysdest2 = 0;) C3 B4 K7 k+ d

  72. ) A8 j! e  w& C) I# L9 @5 ~1 \
  73. char *dmabufsrc1 = NULL;" w) \; A+ b8 ?: Y- N8 s& |4 g, J
  74. char *dmabufsrc2 = NULL;
    " [- a: p+ z  X% H8 Q5 o
  75. char *dmabufdest1 = NULL;; `. [5 S) z) _* o# s
  76. char *dmabufdest2 = NULL;, C$ o7 I, |- L5 |
  77. * h8 G- `) k" J. h
  78. static int acnt = 512;1 d. i+ Q7 X, M
  79. static int bcnt = 8;
    7 K4 A! W' U5 m( g. ~- F/ N, `5 P
  80. static int ccnt = 8;
    / ], K+ f" D* |+ H/ v, V6 Q0 t$ E: B
  81. - X) x3 u& P' C4 F& H
  82. module_param(acnt, int, S_IRUGO);
    $ J3 u. r" p0 u7 y- q
  83. module_param(bcnt, int, S_IRUGO);" w4 I, C& d# Q3 B% a; H9 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" r: m% k. R7 X, v8 P* P. o
. U( P! l  |+ ^; ~0 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% k5 S% }! s" g; ]: aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' P' C: r" ]1 @( A% k9 {7 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 {* x3 O( G& T! ?6 {

, w, q9 `# f9 Q. \
8 l9 l" P1 T' u- `3 b5 O9 c& {. x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-9 12:53 , Processed in 0.038714 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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