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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% C* m" O% H4 D# V9 P5 _
  1. [code]EDMA sample test application
    , ~$ `: |9 }( E+ i0 f! a1 f
  2. /*% p: Q+ M1 X, X
  3. * edma_test.c- z- k7 s9 y, j: A; ~/ b8 J& e
  4. *  \, y; [/ a9 K: g4 R
  5. * brief  EDMA3 Test Application; Q7 q+ u( E9 |" M" \3 ~! P/ P, ], v
  6. *2 S0 a9 b+ J8 M3 `
  7. *   This file contains EDMA3 Test code.$ h1 v% A$ I. d3 M/ B
  8. *
    " m' e* k4 i3 s6 s+ W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # t* X% X/ p. t8 H, g4 \* F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' |$ q, @, |' }; P4 V; C6 d
  11. *         TO CHANGE.
    + L# T! t( ^. w; Y/ F% Z  |# s
  12. *% A1 |5 T0 ]5 N. Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 l/ T" Y: _; b9 ]$ e* L
  14. */ c6 l% G: f. J- d2 I% G
  15. * This program is free software; you can redistribute it and/or
    / [+ P# e* V" N( |) {! l
  16. * modify it under the terms of the GNU General Public License as$ Q, X/ x$ Y8 c% }3 u0 L, h
  17. * published by the Free Software Foundation version 2.) m, I  u2 d2 t& ]7 i
  18. *
    6 _9 k( e" B- q3 z7 E% Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 C( H* r0 T1 r$ k$ n3 d
  20. * kind, whether express or implied; without even the implied warranty8 S. b$ B: I; r7 ~. I* e7 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 b3 T3 I( ^# b# o& p
  22. * GNU General Public License for more details.' k9 F! T+ g& X, |& [
  23. */
    / x, Q' U) Z, t9 K, W5 v' Z( ^/ @6 t

  24. 3 T" |- x  s* j+ a4 T, C
  25. #include <linux/module.h>
    / a. [; N7 {) t0 I( P" I; X
  26. #include <linux/init.h>/ A) K5 R- a% ?8 S7 o& q3 p3 n
  27. #include <linux/errno.h>( h/ f: E; X1 ?2 ]
  28. #include <linux/types.h>1 \4 ~* K3 ^8 _+ l+ p  r
  29. #include <linux/interrupt.h>- T2 h% l4 d  K
  30. #include <asm/io.h>
    $ m+ i2 P3 h! }4 N( ?4 i
  31. #include <linux/moduleparam.h>
    % L4 J1 k0 q9 Y; ]% U
  32. #include <linux/sysctl.h>0 P% D/ ~" j- O( W& {
  33. #include <linux/mm.h>) @+ J0 J- z9 V+ i) H! t# n7 w7 S
  34. #include <linux/dma-mapping.h>
    ; E/ P2 b* w* f! @" B1 Z
  35. 7 a2 q4 z% r! U& `0 x+ p) B
  36. #include <mach/memory.h>2 s0 Z, s5 @( ^  c
  37. #include <mach/hardware.h>
    # M8 X& r: k9 U5 q$ V9 `
  38. #include <mach/irqs.h>) ^5 D$ o3 C. z
  39. #include <asm/hardware/edma.h>
    6 q- e, @. X- E" A! y: [

  40. & ^) o; Z2 [9 b2 ~2 ^3 O6 J% Q
  41. #undef EDMA3_DEBUG  k& b! K+ {! }7 I
  42. /*#define EDMA3_DEBUG*/5 p. U# g  @0 @2 D0 O

  43. , L3 Y" F; r7 T/ W, l% L. i
  44. #ifdef EDMA3_DEBUG
    / Q' Y3 |6 b; A8 u% f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % w& i  U$ X: [2 M8 X3 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 O0 ~$ i% l  f* _, E( ^$ S; c( `9 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 Z/ ?% H4 d: z5 `9 c( b
  48. #else
    * `9 U3 Y! R. a! d5 Z
  49. #define DMA_PRINTK( x... )7 [( ~) b4 }1 K/ v: j4 P
  50. #define DMA_FN_IN' c7 r  N- W* Q. ]* |  ]
  51. #define DMA_FN_OUT) m+ L+ U- c# y( P5 q
  52. #endif) _: W& ]5 _8 b
  53. 6 j+ o+ ]9 B' c) w% F7 x) D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 }+ F) z- a9 q3 H# T( {0 y# _
  55. #define STATIC_SHIFT                3; T2 {* v5 f- ~; p% l
  56. #define TCINTEN_SHIFT               207 N2 x# P3 N) F% S3 D
  57. #define ITCINTEN_SHIFT              212 {5 b' u$ r+ U' I$ E& G% p
  58. #define TCCHEN_SHIFT                22( ]+ N* _) J; L+ F9 S# l! T: k
  59. #define ITCCHEN_SHIFT               23* _) [+ h# C0 g% X
  60. 5 i* ^/ f. t2 Z" A; d" R
  61. static volatile int irqraised1 = 0;( j& t, M) H  p  @, m/ p7 ~
  62. static volatile int irqraised2 = 0;
    . p2 j/ A( v4 w; j1 X/ M
  63. & S; r6 h( f5 s0 U9 Z& t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 s& n. O& M. z' k& d4 ]* i: \7 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 c5 p" E; J0 _; o* @! }  d/ s6 b; ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; E5 j' k. j. G6 q5 e

  67. 5 h& }7 l8 Y- ~- q/ M
  68. dma_addr_t dmaphyssrc1 = 0;$ G1 R3 X  Z) `' q9 F6 ]: ?  C5 [+ D
  69. dma_addr_t dmaphyssrc2 = 0;
    ) g# ?  J: j: c1 {% z
  70. dma_addr_t dmaphysdest1 = 0;; Y, i4 k% B- N
  71. dma_addr_t dmaphysdest2 = 0;5 F1 B( d" M- ^# {1 i  X0 o5 _

  72. . x* d, k1 e! O1 ?, o
  73. char *dmabufsrc1 = NULL;! A3 m/ P. V) o+ I
  74. char *dmabufsrc2 = NULL;
    3 ~  r5 |3 A4 I  ?9 x
  75. char *dmabufdest1 = NULL;7 M4 V  F" ^& H  X$ J
  76. char *dmabufdest2 = NULL;0 v4 \1 h/ W. I5 q- p% ]

  77. ' S5 e0 ^3 J6 h% N' G2 t% m
  78. static int acnt = 512;2 s6 `$ _2 \. z; t) D& F. [; U
  79. static int bcnt = 8;$ l) w  G/ B# A3 o
  80. static int ccnt = 8;
    0 g9 E0 P$ N8 B
  81. 6 c: F) ^0 ~. {% \$ t- r
  82. module_param(acnt, int, S_IRUGO);
    4 k# g4 n7 v- ~! _( M( Y# @
  83. module_param(bcnt, int, S_IRUGO);. t$ U6 f/ c8 ?, f: [- [0 d1 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* |& v8 L8 i+ P9 v( k2 \7 c; c# y. `1 s5 {% [2 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 y( O: j* x( E# Karm-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; \" U8 Q; I8 R$ g3 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ i9 r/ ^7 z. {, x4 v' R
6 I. f/ \" r2 n* l
0 U  N+ q, j: N% I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 14:15 , Processed in 0.041449 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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