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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 \2 L  D0 m5 h3 h
  1. [code]EDMA sample test application
    4 D% h: q+ M) S# r) c% _6 T+ H
  2. /*
    ; @/ @% o  v3 n/ S0 n
  3. * edma_test.c
    , q7 @6 T# H+ I) m8 k7 o, a5 r
  4. *
    7 h- m. p; _- l$ s; N: d
  5. * brief  EDMA3 Test Application
    + v& W8 ^& ~+ I$ l' D
  6. *1 F. {3 q* f! q8 E0 x
  7. *   This file contains EDMA3 Test code.
    $ V' q. g: e* {) A
  8. *" w2 ~: _8 Y0 ^% D% f) G$ M# X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% M  {, u( O$ N3 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 q! w! d* V8 B1 y
  11. *         TO CHANGE.: O4 s1 ]& F. G" `& L
  12. *' e# _! B; T) G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , i0 r, o0 F; J: }- ~* ~4 A0 D
  14. *
    3 G6 F! F, Z9 \* ]
  15. * This program is free software; you can redistribute it and/or+ t+ `  `: i7 p3 b0 U# e' x
  16. * modify it under the terms of the GNU General Public License as3 I( E/ X/ L- t  s
  17. * published by the Free Software Foundation version 2.
    / m6 w0 I9 Y4 @7 ~
  18. *
    4 C# x7 B* ]& |/ r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& T% R. j1 G" x+ P
  20. * kind, whether express or implied; without even the implied warranty
    5 j$ x+ ~& f3 D* r( O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 [1 e, j8 _  ]7 T0 y9 s! ?- P
  22. * GNU General Public License for more details.
    ' _& o% F; o' y
  23. */2 ?0 |2 _8 O! k& E
  24. * P1 L) Z9 r: ^0 y# S
  25. #include <linux/module.h>8 V2 |1 C9 E( e' L5 ?0 h. ^
  26. #include <linux/init.h>1 u6 T* S" ?" r- b# O; I! a" D3 h
  27. #include <linux/errno.h>
    ) V& U5 A; B! q# D
  28. #include <linux/types.h>9 z! ~; {2 v7 }
  29. #include <linux/interrupt.h>6 H, h* G! K/ c1 E* Y7 r
  30. #include <asm/io.h>1 W* H9 S6 k6 J( D4 f$ Y
  31. #include <linux/moduleparam.h>6 I4 _6 w  a; a" t# x
  32. #include <linux/sysctl.h>
    : B: S+ {8 K7 C! `( u" T
  33. #include <linux/mm.h>
    & Z& g* A4 k$ I  D1 o! c' u
  34. #include <linux/dma-mapping.h>
    5 B% J: Y2 i/ d# K( W

  35. + @9 t" J" B! m' u! J
  36. #include <mach/memory.h>& q% l# ^. s. W% T. s
  37. #include <mach/hardware.h>
    ) w1 v) Q! K7 h+ j  K# h# n) ]
  38. #include <mach/irqs.h>
    , s: _2 J, N! L
  39. #include <asm/hardware/edma.h>
    ) [$ ^( |1 Y; Q$ C
  40. 2 C: k* S# X) g; a$ {
  41. #undef EDMA3_DEBUG4 O% N3 e7 {$ ~8 P
  42. /*#define EDMA3_DEBUG*/8 V9 v( [8 K; K& p+ B  L
  43. # E6 g- }. F1 }1 D5 N$ X
  44. #ifdef EDMA3_DEBUG
    ' B  y: e; l; Z) I) O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % Q! _, R7 a' }/ d: Z: N5 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) d4 A* @, O. \% B: \7 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ W# G. p: A2 ^! {4 T& I6 j8 N
  48. #else
    4 f) p. W( G6 z1 ^
  49. #define DMA_PRINTK( x... )
    $ V! F! S' \$ U* k" n. P' f$ R+ Y
  50. #define DMA_FN_IN$ Y$ Z. |6 \" f
  51. #define DMA_FN_OUT
    $ e+ j) t) A( z* E
  52. #endif
    ; K. [5 P$ {3 ?6 ~
  53. ! b- r9 o5 \5 S. _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 g( Z7 S# ~# }  n9 I# m# m0 O4 r
  55. #define STATIC_SHIFT                3
    ! `4 u2 E0 ^! D9 p
  56. #define TCINTEN_SHIFT               20. A$ `6 h5 ]# J! D/ n% m
  57. #define ITCINTEN_SHIFT              21
    ! f- \* {( l: I, s! ^0 }  e+ v# x
  58. #define TCCHEN_SHIFT                22
    0 L- n' t7 h) u& K
  59. #define ITCCHEN_SHIFT               23  r  U. \- p* @+ t
  60. % d4 |8 H" r- N$ O& p9 K6 E; ?0 e
  61. static volatile int irqraised1 = 0;
    : J$ Z6 l  h6 M+ n( g8 z  {" U' n
  62. static volatile int irqraised2 = 0;- e) ~3 v2 m5 {# _$ F" h( j# \
  63. 3 s1 W, b! `! ~  J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / }# `- F! Z$ _2 R. M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% C2 v* Q! |& z: t- l" K# J) m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( |( A: F4 i- ~

  67. " I6 V1 Y. Z  P8 ?
  68. dma_addr_t dmaphyssrc1 = 0;0 B1 b+ `( A5 @" V0 e
  69. dma_addr_t dmaphyssrc2 = 0;
    & `' O3 a+ ]3 q0 z8 z: p
  70. dma_addr_t dmaphysdest1 = 0;4 U; O* B  V8 G, W( K* B2 s
  71. dma_addr_t dmaphysdest2 = 0;9 \3 H5 e5 M# Z( B" ?
  72. ) n4 X2 }  D& i- V/ L) S: Y
  73. char *dmabufsrc1 = NULL;) V" r- c* @! h" Y5 j
  74. char *dmabufsrc2 = NULL;0 X. @' S  \+ }$ L! S7 ^  X
  75. char *dmabufdest1 = NULL;( X( V1 R2 f& H1 V
  76. char *dmabufdest2 = NULL;
    - s# B4 @3 |! H" B6 H6 l1 `
  77. ; H0 _; X  v- G' E
  78. static int acnt = 512;2 \& r  S- O/ o3 R" [
  79. static int bcnt = 8;
    6 Y3 |: `* m# ]3 R
  80. static int ccnt = 8;
    * G* P4 K' J9 _9 B
  81. . `# v. E+ d! P+ I, o
  82. module_param(acnt, int, S_IRUGO);
    . }, r1 L- T) ]0 R+ y, M
  83. module_param(bcnt, int, S_IRUGO);/ z& a! k; h# ~9 D& n" T: C$ h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ w2 i9 }8 \! L7 o
5 }' p. z6 d3 t2 P8 X$ t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; M; I3 b5 b. }* _
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' Y1 i7 Z9 j. D0 J' F7 ]3 k# A" n. T9 d3 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ Y3 _# f- y( F0 f
, E1 d$ n+ O& z' E

# r* H( M8 ^1 r: F& S' j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-19 07:41 , Processed in 0.039210 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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