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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / `8 `% n( }; a+ e
  1. [code]EDMA sample test application
    ; o. s' P- }# f6 S3 e3 k/ k" M! S
  2. /*8 U% z& }5 T1 f6 p
  3. * edma_test.c
    8 X: f$ u' f5 t
  4. *& I; Z% W) K- q# e; a7 H
  5. * brief  EDMA3 Test Application- F0 c  o* t6 p
  6. ** `: x1 w7 I) l$ H, z! [* w
  7. *   This file contains EDMA3 Test code.
    # y8 b2 O4 f: E7 a8 P& f
  8. *
    1 T/ q: V/ Y4 _) K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 q8 Z! f) W6 }" Q9 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : X) I$ Q7 }0 o2 a( H2 A
  11. *         TO CHANGE.1 {3 H2 |; \8 g& c  |
  12. *
    " U2 F, F. G- j1 t. D* G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; z( Z" ]8 N: m" a, o. b6 X
  14. *5 k- N6 Y7 r" R
  15. * This program is free software; you can redistribute it and/or2 h$ `9 M, H" i( F9 F7 ?7 e" q
  16. * modify it under the terms of the GNU General Public License as
    7 k; Q4 G) q( }( ^$ c
  17. * published by the Free Software Foundation version 2.& x( \' v7 L/ ?
  18. *
    $ ^. A: e& ~. k+ v9 v1 R# g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; D+ k2 k9 B+ l5 h/ Z
  20. * kind, whether express or implied; without even the implied warranty. S9 |4 F5 I, y) ~# p8 v. u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 x2 i, a$ O% _! O0 A. N$ i
  22. * GNU General Public License for more details.. G2 c& ?6 }5 t
  23. */4 d8 C, \- C3 @9 y

  24. : O; [0 |* E6 k. p- `5 w
  25. #include <linux/module.h>
    7 @* ?$ n8 _/ n. a4 F6 _' l
  26. #include <linux/init.h>: ]. z: z5 x2 t! ?6 Y$ a& ?
  27. #include <linux/errno.h>" \1 |% l* I2 g
  28. #include <linux/types.h>
    $ L% Y- p; B* L2 B% h% `
  29. #include <linux/interrupt.h>
    " Y  Z+ K9 V8 N: G* ?
  30. #include <asm/io.h>
    - o( U6 K4 k, Z! @- h
  31. #include <linux/moduleparam.h>
    ! U& P% t- s0 O1 i3 G4 J* b+ ^
  32. #include <linux/sysctl.h>
    " R; @( d$ Y9 X, H: L
  33. #include <linux/mm.h>
    & d; u9 |; b8 X# k9 L* M
  34. #include <linux/dma-mapping.h>. T# i" c+ ?! b+ C3 _

  35. : i1 |' S" }" f* g: T+ {' r
  36. #include <mach/memory.h>
    5 l) U) l. T% V, H- m
  37. #include <mach/hardware.h>% I4 b( r* h% K# R$ c" Y" t$ \! d, R
  38. #include <mach/irqs.h>0 H0 ~& W2 t% x
  39. #include <asm/hardware/edma.h>
    ( b. d2 T0 c( }; b2 }4 w3 @9 J9 o

  40. ! |  m( _; T/ d8 b6 q5 G
  41. #undef EDMA3_DEBUG& }2 T) `/ }& l& e$ f7 X
  42. /*#define EDMA3_DEBUG*/% c- {5 e0 I% T. t% O" N
  43. 7 s7 b2 I3 |1 m4 }6 x4 e! G
  44. #ifdef EDMA3_DEBUG, ?7 `; Y4 t# a6 l0 I; Q) J& Q9 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; V! @% }. N! e! H2 \$ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 W& y* n3 v3 w# [9 `/ a2 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 l) V' l$ L& ~" q1 U& Y  m
  48. #else6 ~. n$ r) U, C9 ^5 g
  49. #define DMA_PRINTK( x... )' e: z$ u  k: s! A3 F; ^8 Q
  50. #define DMA_FN_IN. K6 t# L2 R$ Y% d  `  z
  51. #define DMA_FN_OUT
    + @7 D( Z% C  _0 i: N  c9 A
  52. #endif) H2 F0 x- x7 l! a

  53. $ e- i4 I" i: Y# y% y1 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( D: h. c  N0 b; r& }/ a4 |! B+ S
  55. #define STATIC_SHIFT                3* B* P6 Q) _, h1 _" [
  56. #define TCINTEN_SHIFT               20
    / p, W9 }9 O6 ?+ v- v8 T, E2 X
  57. #define ITCINTEN_SHIFT              21
    % S! B1 n! P; K1 e
  58. #define TCCHEN_SHIFT                22
    + _! V/ s1 \1 D1 s' W
  59. #define ITCCHEN_SHIFT               23
    0 _* l( R/ C' u. _! o

  60. - h+ V3 s2 m/ u+ {
  61. static volatile int irqraised1 = 0;
    ! O/ n6 `6 H# w1 r$ o6 D+ B
  62. static volatile int irqraised2 = 0;; n7 G& L! ?8 ]. {

  63. + A! l7 U$ {; ~* ~% g2 `; g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; B# i# N$ L. |: i5 T5 N9 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / X4 b* J5 w1 L; \3 T3 B; j3 t9 M. }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* o+ t9 S0 E0 v( }) U
  67. : {" e" i; d! t. t- x1 z
  68. dma_addr_t dmaphyssrc1 = 0;! w  W3 ~  ^& K2 ?5 v* t5 H2 l
  69. dma_addr_t dmaphyssrc2 = 0;
    3 G. v& r. Q, v3 B( H, n0 Z
  70. dma_addr_t dmaphysdest1 = 0;% Q' G: c& q6 e) k
  71. dma_addr_t dmaphysdest2 = 0;- l  Q& F' Z& h" ~* c6 ]" N
  72. 6 S; @+ ~# r# w/ W5 l. h; m
  73. char *dmabufsrc1 = NULL;( e" J* n: J# K: f
  74. char *dmabufsrc2 = NULL;
    9 J- W9 |9 `/ n9 Y/ }
  75. char *dmabufdest1 = NULL;0 }, z- e, R- {1 b& P
  76. char *dmabufdest2 = NULL;
    / {/ Q+ M* }9 a" m& Z) H

  77. 4 p$ t8 O9 V/ u7 Z
  78. static int acnt = 512;5 y6 h( N7 r7 f; N5 I3 A' c
  79. static int bcnt = 8;
    ; H0 g1 g; U1 k
  80. static int ccnt = 8;4 L+ v! M/ t6 t0 Q$ c
  81. ; |- I3 O0 d2 Y" z: f3 v
  82. module_param(acnt, int, S_IRUGO);9 r7 b( [* e& G2 {$ w8 d3 v
  83. module_param(bcnt, int, S_IRUGO);
    1 u5 x. k# m5 ~  V/ f0 J" k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) I" i! e' h* v7 @( L% c: K1 I9 u2 e  p5 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, l, Q; c& f. l& `2 ?  @2 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# @3 P) h! I0 U5 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" N, ?4 G- t  p

( Y) Z4 g0 P0 C. W6 w) z$ R7 [5 @3 k. x, u( f4 N+ c1 r) d* A- r# G% _' A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 12:04 , Processed in 0.039837 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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