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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 b4 w% [( @; g& D# L# L+ r* [
  1. [code]EDMA sample test application
      f, n' c) t4 X
  2. /*
    9 O0 _% ~/ B6 [& U- d% m6 V
  3. * edma_test.c
    , |# U9 }) |9 @
  4. *
    ; e; l" N# X- Q! W
  5. * brief  EDMA3 Test Application! Z5 S/ S: S8 A  K2 L' F1 N# {2 S
  6. *1 ]) n2 K7 ^$ R  ~& }
  7. *   This file contains EDMA3 Test code.) N# U' s: a2 C' M
  8. *
    % D8 a* I' g4 e2 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 A" T" c  c3 F7 {4 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 t( a/ g' L0 b# S- W! L
  11. *         TO CHANGE.$ y! Q  |; [% _0 ?
  12. *- L4 {: }" U) m0 K' q7 e! V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , C8 f& ^, X$ P" c3 _; z
  14. *
    " a/ f/ a+ }  P
  15. * This program is free software; you can redistribute it and/or7 p+ w2 v2 i2 X0 G% s7 I
  16. * modify it under the terms of the GNU General Public License as) z7 k( Z* C+ J% K7 v) q0 _
  17. * published by the Free Software Foundation version 2.
    $ n4 y$ ?9 `0 S7 |. g
  18. *
    * f4 u+ L$ @% o4 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * _4 R7 c4 S) v6 y9 k/ e
  20. * kind, whether express or implied; without even the implied warranty% X$ i3 o1 T! J6 [9 m) n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , o6 d$ a  C: v6 b: d
  22. * GNU General Public License for more details.
    ( ~9 s: ]# R8 ?1 N# [
  23. */
    ' R: Q$ i6 N# [

  24. ! o# @+ H5 t9 }
  25. #include <linux/module.h>
    : }8 L; s! u# W% ~
  26. #include <linux/init.h>
    ; k$ X& X+ J6 B1 J$ p+ x9 ]
  27. #include <linux/errno.h>" c3 W& n. P1 M4 y3 F
  28. #include <linux/types.h>
    9 F. l2 ^. W  W' x/ d6 N: I# u; Z
  29. #include <linux/interrupt.h>, }$ ~. v3 @% b- X. V! f! k+ V; V
  30. #include <asm/io.h>
    5 _1 l) k; r6 t, g5 H
  31. #include <linux/moduleparam.h>3 u& ]/ `! t# `5 S7 [: K
  32. #include <linux/sysctl.h>. B3 G0 M$ y- D) w  G
  33. #include <linux/mm.h>
    . s6 `! T* L1 Y6 t
  34. #include <linux/dma-mapping.h>
    9 y4 o) F6 V3 I1 V; ?# z

  35. ; c9 o  F, v- z# H. |
  36. #include <mach/memory.h>  f- Z( ?, A! H$ k, q/ ?, ^, L4 O$ x
  37. #include <mach/hardware.h>
    : q. f8 S, K" x  |" P3 J1 b
  38. #include <mach/irqs.h>
    0 I, @1 u3 g8 J- Q1 I) H% N
  39. #include <asm/hardware/edma.h>
    6 W, m/ p) a# @: Q- R

  40. + S, U# f7 D' t+ i9 D8 g. k
  41. #undef EDMA3_DEBUG- n3 S3 t6 K) S- _/ G
  42. /*#define EDMA3_DEBUG*/
    8 h* I7 R) ?% u+ Z  a

  43. . A- r1 N& j, H3 U- j  o4 q- n
  44. #ifdef EDMA3_DEBUG8 h' u  A  C4 k( _: w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * c# o4 O/ p0 K1 V  ^6 ?6 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# ^8 u* |6 h0 Q. y0 b. f  u- R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 y- j7 q5 K+ e$ a/ M
  48. #else
    $ Z% P  ?4 U2 C3 u! j
  49. #define DMA_PRINTK( x... )$ O' o: H( H# v  K& c
  50. #define DMA_FN_IN9 g2 L% I% m2 v5 K( T# c
  51. #define DMA_FN_OUT( s# L) ]! E( h  B; b* E
  52. #endif7 {' ~! l0 @5 `) _- }6 Q' S
  53. + \7 P- A( G: G8 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 w- ]4 o9 z! c: ]* a
  55. #define STATIC_SHIFT                3
    4 j4 o9 M8 X+ z  c' W, R
  56. #define TCINTEN_SHIFT               20  d1 F0 N+ X% C" y
  57. #define ITCINTEN_SHIFT              219 @. {  a% i5 [  O% i/ y+ e
  58. #define TCCHEN_SHIFT                22: ^' d0 d( f" f# X
  59. #define ITCCHEN_SHIFT               232 l1 J7 K8 C5 h% T+ _
  60. - t6 v0 i- `9 G
  61. static volatile int irqraised1 = 0;# I# ~* A9 j- w' P2 k
  62. static volatile int irqraised2 = 0;
    * v! {! e" c. T* a
  63. 2 |- L2 X+ |6 S0 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {7 V+ I- q/ ~- e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ~! k+ v8 M0 q2 B% G% J  t% `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 v4 d6 H) r9 @. W* b3 f
  67. : w1 x4 E: B% D% ^! ^0 N( L- d8 m2 ?
  68. dma_addr_t dmaphyssrc1 = 0;
    " ~$ s2 p( ~, g
  69. dma_addr_t dmaphyssrc2 = 0;
    & S8 g* G1 J+ @+ l# A- r
  70. dma_addr_t dmaphysdest1 = 0;) Y6 O/ d8 ^/ y( b( j% P! R
  71. dma_addr_t dmaphysdest2 = 0;. p# |) N  G5 o" X+ E# `8 ?; m
  72. + G. H- _, c0 K7 o( Q, h2 u. x
  73. char *dmabufsrc1 = NULL;. f7 U6 X5 f$ N$ O4 m2 o8 W
  74. char *dmabufsrc2 = NULL;
    6 ]* m3 |4 F6 Z) z# J4 m* M
  75. char *dmabufdest1 = NULL;3 f. M+ G. p% B* I9 L1 j
  76. char *dmabufdest2 = NULL;
    # j/ N! Q+ Y3 l/ h9 P# |& v1 E  Q

  77. - A! j% T8 W* m- c
  78. static int acnt = 512;
    9 s! \3 e9 O; P
  79. static int bcnt = 8;6 x: V* f7 V# `' x, k
  80. static int ccnt = 8;  L" r+ s4 w! M6 X# ?+ h
  81. $ u2 w* j* Y" r6 X% |: q
  82. module_param(acnt, int, S_IRUGO);5 r: v2 e3 `/ Y, {7 t
  83. module_param(bcnt, int, S_IRUGO);
    ! @: D2 o) Q+ P; R9 U. w, \0 l/ G0 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  E' _: B5 a  M0 u% I' `6 B4 F: l

! A9 S- P% k0 `, c7 P7 V2 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. @9 E5 m: |) o3 x9 Y- I; {! z9 X  a5 Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 Z! n+ w" [* ^" [: Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 A( V+ x8 H" O& i9 }) d: y
  c4 R& [: k. z: i5 N- ?

$ B# y$ I" R8 [6 r3 R1 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 10:21 , Processed in 0.038663 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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