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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ~' ^: V' w) ^( ]9 i5 Y1 ^. F9 B
  1. [code]EDMA sample test application8 v- Z& c0 L/ m" b4 i# A
  2. /*4 [. }, Z- E) ]( F* j4 E: R0 f
  3. * edma_test.c
    2 V" h1 o$ ?! o7 \1 S! d3 E
  4. *
    / W# K+ {2 U5 u; [0 v* J) c. }
  5. * brief  EDMA3 Test Application
    9 {4 B. I0 R% F4 l, T
  6. *
    2 L4 J* t: H' T- i4 Q. Q8 {6 z- p5 C
  7. *   This file contains EDMA3 Test code.. ]8 m5 q+ V6 H% T& n! o' L
  8. *, R8 r" p6 B6 ]- s% c! |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; L5 i( J( r1 \' ^& q- Y0 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 x( N. t' o3 G# @9 r# `
  11. *         TO CHANGE.# K/ ~+ a! T9 J6 ^1 ^& n
  12. *
    5 H2 G2 C; n+ p5 G" M: e3 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" e+ h. p, x8 J5 u( d
  14. *
    3 N9 _/ F; m6 N4 e% y! T; D, o3 [- i
  15. * This program is free software; you can redistribute it and/or
    7 J1 E$ E& a' z! G/ m+ Z' J6 k
  16. * modify it under the terms of the GNU General Public License as( H' \; G& Q: {7 }7 J. a) s2 ]
  17. * published by the Free Software Foundation version 2.! |5 f- w) z- q3 ^  J
  18. *- o( F) I* m8 J2 E( a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 r! Z3 m. ~0 ~8 o# s
  20. * kind, whether express or implied; without even the implied warranty
    5 O; d! p5 [7 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , y0 _3 q9 U$ |. I& Q( |
  22. * GNU General Public License for more details.
    : U0 |8 I3 h8 @+ t3 m( c& r
  23. */
    0 S/ n9 I" x6 i! l
  24.   B' e9 x. L, ^# j1 o- J: k
  25. #include <linux/module.h>$ b( G0 p! D8 Z7 L+ W- n
  26. #include <linux/init.h>
    % f  d/ F- d* a& }( b
  27. #include <linux/errno.h>
    . R  h4 [- D5 z! L8 t* a5 @1 s
  28. #include <linux/types.h>/ X& z# u" [5 h) h8 S! [) v' v! I
  29. #include <linux/interrupt.h>3 b7 ]/ e% [/ V5 h+ q' z2 m
  30. #include <asm/io.h>- l3 e: r% D" z$ ^) o
  31. #include <linux/moduleparam.h>/ V) Q% p: Y* M# E0 ~" l
  32. #include <linux/sysctl.h>" q9 B0 i" W1 S, _" L
  33. #include <linux/mm.h>! U! _4 f1 u7 |% ~; p2 U
  34. #include <linux/dma-mapping.h>
    + t* j% k/ F& H, K+ f) f' m

  35. * u( e( ]1 v3 K- C4 Y) a6 g
  36. #include <mach/memory.h>
    # G9 d" b# c1 l7 ^
  37. #include <mach/hardware.h>% n+ V6 m+ {1 I. w4 @+ w
  38. #include <mach/irqs.h>
    4 }' D; h- N. Z8 l4 n: @
  39. #include <asm/hardware/edma.h>
    5 K( y3 o* Q3 Z: I; G- r* V- L
  40. : x( _2 @( P, X9 q. l, o
  41. #undef EDMA3_DEBUG
    ' [$ `7 j. B) u
  42. /*#define EDMA3_DEBUG*/
    0 q" t7 V1 K/ C+ `9 l$ ^( k

  43. : o6 b6 y- P  [) |- A% H5 m
  44. #ifdef EDMA3_DEBUG' ?9 p0 v, m. k$ |9 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & v# p6 t* \( h. K  f0 h  Q, c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# V/ s( |7 F1 t/ L4 g; H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " z! v+ c+ F1 B$ _3 k6 k
  48. #else
    8 a* \; k; i' [, e" K
  49. #define DMA_PRINTK( x... )4 B% P% U: e, D) Y* x- H
  50. #define DMA_FN_IN
    / Z6 X6 O, v2 l3 x1 b( W) g
  51. #define DMA_FN_OUT
    * ^0 O6 P& a+ z
  52. #endif
    : N; u% u4 {+ ~
  53. * G2 b* R. B) e8 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 I, o' ?# u7 T/ ?
  55. #define STATIC_SHIFT                3& P2 t( E2 c# s6 \
  56. #define TCINTEN_SHIFT               200 l  w. k2 U, r) E; w9 G5 ]# G2 g
  57. #define ITCINTEN_SHIFT              21( {" A$ J0 e$ O7 D. G0 Y# m
  58. #define TCCHEN_SHIFT                220 {( o- m. R5 T$ P( N& W5 s4 c
  59. #define ITCCHEN_SHIFT               236 Q3 |8 ?: C+ i
  60. # I  L. ~* r# U: ^! b
  61. static volatile int irqraised1 = 0;4 B! A% o. w& m' }6 r
  62. static volatile int irqraised2 = 0;. T( L; P) R1 ^* U1 `# y1 w$ G

  63. 4 k+ K  {' V$ \2 H7 P# r( g' f9 e# U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  I* g! |- }1 C/ s% c. r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  E" |, z* E" G0 p9 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 v6 P  Q( P" T+ k
  67. ) q& ?# N7 R- S. [8 s
  68. dma_addr_t dmaphyssrc1 = 0;" S' r# o6 [  N8 Q/ n! t
  69. dma_addr_t dmaphyssrc2 = 0;  f2 d2 y& w" [
  70. dma_addr_t dmaphysdest1 = 0;7 I# |" `1 B& }7 {* I4 A' ?
  71. dma_addr_t dmaphysdest2 = 0;7 n# B0 c, |$ y3 U/ V) [! A
  72. 7 O3 z" B, m3 X8 X1 `4 ]0 c
  73. char *dmabufsrc1 = NULL;
    2 _* w0 V5 _$ _  J9 O
  74. char *dmabufsrc2 = NULL;1 b8 q3 F; }% f8 e
  75. char *dmabufdest1 = NULL;- m! W3 q7 f/ u# K5 q
  76. char *dmabufdest2 = NULL;1 B' A1 P& L/ U' o
  77. 6 g3 @! \/ J, p/ Z; F
  78. static int acnt = 512;
    # e! U. i2 ^. ~. V! [: L
  79. static int bcnt = 8;
    8 C4 [# C' r9 k/ ^7 b/ m" N
  80. static int ccnt = 8;
    3 \" T% h4 W$ y3 D4 ^% @

  81. 9 R  k# w  t6 |# z/ z* H
  82. module_param(acnt, int, S_IRUGO);+ x% ~: {( W# L* T7 F$ {
  83. module_param(bcnt, int, S_IRUGO);
    ; }- v# H+ H1 X- q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 K/ H9 A" k  |0 S; j/ }& M7 L/ z$ Q3 f" w5 \2 v4 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 g7 T2 ]0 M. {1 R; a! P% |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ w+ c7 i( V: x( j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: c) a; w- z5 }. H6 s2 Y( [# N
0 W. d. X9 n% ^1 g/ _3 G& z6 T: _3 G; {9 B( s. q9 f7 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 04:59 , Processed in 0.040234 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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