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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( w& u! Q6 r8 R3 ^
  1. [code]EDMA sample test application. I+ E, O4 K/ q+ C; O; l3 m! ~( O
  2. /*
    . Q/ @3 M: T7 }% x2 Q) \
  3. * edma_test.c* T4 Y  u2 Z4 T9 _& i1 K
  4. *
    5 f  l: o# Y1 R& C& ]7 i8 ~
  5. * brief  EDMA3 Test Application1 U& P  @- ~% L$ z" C
  6. *
    4 Y/ J# n! l0 E% S: a
  7. *   This file contains EDMA3 Test code.: S8 J2 m4 _& ^4 {
  8. *
    8 R" r$ d* m) Q4 [' ~' a9 M2 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & X  I+ R# B8 E9 S# V9 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 U, N+ c. y6 K9 T* |9 I" [% d
  11. *         TO CHANGE.
    ) I2 b9 g7 J7 \# _, P
  12. *
    1 q: r. s) W/ J* ~$ V" a6 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& @) n7 E% i/ M, [, A$ Y
  14. *$ B5 F8 f7 B  e
  15. * This program is free software; you can redistribute it and/or/ @3 M" X) A0 |* n  d( j0 O- R1 {
  16. * modify it under the terms of the GNU General Public License as* w" T- Q  e' h# L, ^# X
  17. * published by the Free Software Foundation version 2.
    5 ?3 T4 K. `( ^/ W7 g, K9 {- N
  18. ** s( U% t6 c* V0 ^6 v. i5 S2 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ o2 w1 I* z6 M8 U# t
  20. * kind, whether express or implied; without even the implied warranty
    ) c0 b8 L/ W: V& a0 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 g) W' V1 B5 K% d( o
  22. * GNU General Public License for more details.& E  s, {3 ]% h- p7 V" l
  23. */
    3 s6 D8 o, v4 H* Y- `

  24. 9 i8 A9 }! Y' t) y1 ?
  25. #include <linux/module.h>0 ~4 A6 A/ d$ v, C4 V) L
  26. #include <linux/init.h>
    0 j' U: s$ D1 }" S
  27. #include <linux/errno.h>
    $ E6 S8 Q' \3 H6 \4 I% z0 @* m
  28. #include <linux/types.h>
    5 E# x7 N) o/ ^. S
  29. #include <linux/interrupt.h>7 P- {6 X' p! z3 Q/ E
  30. #include <asm/io.h>, d+ h0 R8 x7 \. \8 R; u
  31. #include <linux/moduleparam.h>0 l. `6 ]: Y$ m' H5 y, V2 @3 z
  32. #include <linux/sysctl.h>1 c3 t  z' |& A% B6 _- `4 Q* y4 C
  33. #include <linux/mm.h>
    : ~, k; P5 n9 M& f8 n8 G) q+ d; H
  34. #include <linux/dma-mapping.h>8 s6 j, S7 y" L0 A* h
  35.   D/ z  d6 i( g2 b
  36. #include <mach/memory.h>
    * P6 r8 J. k# K1 I2 S
  37. #include <mach/hardware.h>
    6 H! ], ^6 K, _; _
  38. #include <mach/irqs.h>1 a" s7 d3 A) p) a( n( C4 v
  39. #include <asm/hardware/edma.h>
    " t# @. F; s& o) V

  40. , f( p6 [, D; c. \( M
  41. #undef EDMA3_DEBUG
    ' ^0 L: W& f+ B, A8 r% D2 I+ S
  42. /*#define EDMA3_DEBUG*/3 s1 ]. e1 A! q  A5 u! k! c

  43. , j2 F/ ?$ m. X' V& ~
  44. #ifdef EDMA3_DEBUG+ b1 B7 T2 T! l) J8 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  I2 m' `/ Z+ T9 x& C5 j! g9 X+ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) M8 T9 ^+ j: ?- n$ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 i4 z4 ^  h4 K5 t  f6 G
  48. #else  \, U: T1 G/ ?# N
  49. #define DMA_PRINTK( x... ): b( L+ c+ Z% A# _
  50. #define DMA_FN_IN
    : C5 D% L% L% l, A. q% V6 `3 q, Y
  51. #define DMA_FN_OUT
    ' o% t- @' N* O
  52. #endif" A! Y5 w9 ~' x/ `( z. v

  53. # a" y4 F7 n' \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), N% K0 Q) e1 c9 ~7 v# C: i' \  c; {
  55. #define STATIC_SHIFT                3( l6 |9 a2 a0 `6 I
  56. #define TCINTEN_SHIFT               20
    ; f" O9 ?9 h9 N3 ?
  57. #define ITCINTEN_SHIFT              21
    8 T/ G# d8 V: V, A
  58. #define TCCHEN_SHIFT                22
    + C1 m9 [" T7 k: j1 K9 L/ P& P9 ?
  59. #define ITCCHEN_SHIFT               23
    # a  V' e1 r, Q. K, K

  60. - H/ r# y4 l% O( K
  61. static volatile int irqraised1 = 0;0 l, G/ b1 o! t! y5 V
  62. static volatile int irqraised2 = 0;
    9 @: i3 P6 f4 Y+ q8 h( D. W  N" m/ A
  63. 0 p( S( |: V1 F  z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. @; X8 G& g$ g! }1 L% p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j; t' z& U/ I4 m" `# Q6 P  F- V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z0 F' \# a4 ^+ E

  67. 8 ~9 w; V" {# z$ |* W5 K6 y
  68. dma_addr_t dmaphyssrc1 = 0;
    8 Q( I9 ~8 V# `) f+ L. C3 ?
  69. dma_addr_t dmaphyssrc2 = 0;
      S$ ~6 O# G" {# ?* U6 ^# u
  70. dma_addr_t dmaphysdest1 = 0;
    - }6 ]' ?  J! B* o  u! T' }- e
  71. dma_addr_t dmaphysdest2 = 0;
    $ e1 C  n) E8 B! E5 ?

  72. 2 B$ ]) A- Z0 e; K1 o1 P  \( `* {
  73. char *dmabufsrc1 = NULL;% X' E$ \6 T) G* l
  74. char *dmabufsrc2 = NULL;* S2 V7 e& ]4 o/ L5 d8 L9 L
  75. char *dmabufdest1 = NULL;
    : V! p3 L( F4 l- o- H
  76. char *dmabufdest2 = NULL;6 w" T  k3 ~1 q# m  \9 R' a
  77. 1 e  C/ O3 x+ L
  78. static int acnt = 512;
    - z+ l# t; d/ X$ {4 z8 H
  79. static int bcnt = 8;
    ! A$ G2 {4 {7 |! N) x5 V! h6 w; W' d% x
  80. static int ccnt = 8;5 ]& q7 g4 l0 N4 ~
  81. 5 o# s- k7 a  Z) |7 U
  82. module_param(acnt, int, S_IRUGO);( Q* y5 T! P' [
  83. module_param(bcnt, int, S_IRUGO);, ^& G' f+ a+ V: ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, w2 P* z3 ^9 G0 K* C
$ f6 \, j5 Z" t2 O9 R- ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* w$ `6 T7 a( M. d0 J! yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 d& G% F& m5 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 N' e5 b: M. p
' |% c( J3 Q5 i* r( X$ y' |3 D

& ?1 B+ `8 H5 C( E# d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 21:48 , Processed in 0.039783 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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