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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* u. D% e5 ~# Y5 k/ J4 S3 c
  1. [code]EDMA sample test application$ `3 Q$ H" \, z# [
  2. /*
    $ `" j4 |0 i! W0 ^
  3. * edma_test.c+ J" ~' s+ T' m* I
  4. *. i$ _) q* a  |/ v
  5. * brief  EDMA3 Test Application
    " {  d& X0 L3 P1 {" Q# @% `
  6. *
    : g" k" U+ I7 W& Z* P+ s1 @
  7. *   This file contains EDMA3 Test code.3 E( T6 t1 N) I3 m( D& J
  8. *
    9 l5 s" I) q* S# ?' U# q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' g! f) e  P* X1 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; p/ |- j3 X' ^: G
  11. *         TO CHANGE.) a3 j0 _, S3 c/ x+ l' s5 V
  12. *
    . q, l( W- ^1 I6 q* j2 [1 i( a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. B8 I1 K6 ]' \* g; x
  14. *1 N0 u) R+ E3 t* ]# Z/ E
  15. * This program is free software; you can redistribute it and/or
    , H8 Y# _! |) }. K# ^
  16. * modify it under the terms of the GNU General Public License as
    ; r4 S( B: }/ m/ O( P3 k
  17. * published by the Free Software Foundation version 2.8 s/ [8 H9 H6 }6 v2 j! B2 g
  18. *8 i( ?/ g1 P. Y5 D( R/ j! z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 g4 Z8 Z2 U( N9 E
  20. * kind, whether express or implied; without even the implied warranty0 W: J4 ~, G, R5 M2 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & e1 e, ~1 j' F7 n" `5 L, l  l
  22. * GNU General Public License for more details.5 O$ D% e" a3 k1 B" \
  23. */
    & d& i: w) a+ i
  24. 8 d6 G! M1 T# @3 `! e. Y+ l! k
  25. #include <linux/module.h>1 m4 g! B3 p% s$ d( ?
  26. #include <linux/init.h>
    $ a+ `; i% N- _! e+ ~
  27. #include <linux/errno.h>
    " \9 s( M2 [3 V& q- f, R4 n
  28. #include <linux/types.h>( W6 k* K6 D+ {
  29. #include <linux/interrupt.h>/ H& q+ ^( F1 T& m' D: h
  30. #include <asm/io.h>; I0 C  M  J/ P/ c1 P
  31. #include <linux/moduleparam.h>
    1 _  N0 Q9 x4 }
  32. #include <linux/sysctl.h>, S3 L1 x% _. l% Z
  33. #include <linux/mm.h>* U# v, m5 d1 h3 B) X" I% _# S- z5 E
  34. #include <linux/dma-mapping.h>
    % ^6 `2 _7 B' s/ t: U
  35.   s& S9 n- B; F8 y# E1 m
  36. #include <mach/memory.h>+ X6 f( H, c/ @0 b
  37. #include <mach/hardware.h>$ p/ k1 p: a/ z  t
  38. #include <mach/irqs.h>/ {7 |) r; d, k7 e
  39. #include <asm/hardware/edma.h>1 Z# R5 t/ S. N- c

  40. 0 V4 h& A$ A  p2 p8 g3 P. S7 D
  41. #undef EDMA3_DEBUG
      o1 L# E0 O9 Y; q3 G' e
  42. /*#define EDMA3_DEBUG*/
    1 R9 g! S+ _" |7 R9 ?

  43. 5 u* r7 {$ U) n+ e' N5 a& D! }; Z
  44. #ifdef EDMA3_DEBUG
    0 w- J1 a2 f9 Z. Z5 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); Q2 A/ D' F5 n7 U; B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 S3 j$ l3 v& d- ]; G3 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      u- N$ W/ z$ v, \* d7 p
  48. #else
      ^9 \! K$ r, N9 _$ r
  49. #define DMA_PRINTK( x... ), T) j$ M# A* e9 @6 G
  50. #define DMA_FN_IN
    $ I9 @. [5 C" I
  51. #define DMA_FN_OUT
    " l8 j# G' o# N( \
  52. #endif
    " M4 b5 s. u( C+ O; b
  53. 2 E  y6 p; ^3 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ C6 X+ y$ T( ?) G" @
  55. #define STATIC_SHIFT                3/ s0 O0 A, T5 }' u+ h5 x
  56. #define TCINTEN_SHIFT               205 E4 P+ f  y" ]
  57. #define ITCINTEN_SHIFT              21/ \. a0 ~4 R( g" H; Z- p* I2 X
  58. #define TCCHEN_SHIFT                22
    - J8 M" k4 ]- [! d: y3 X! q
  59. #define ITCCHEN_SHIFT               23) h1 U6 o0 g9 l
  60. : @! p0 W7 D% q$ d
  61. static volatile int irqraised1 = 0;+ ~# L% A6 H' b  T# z
  62. static volatile int irqraised2 = 0;- D3 Z9 @4 ~( J1 b0 y$ Q: M$ J
  63. 5 g( T" O1 y# Q+ V4 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ b% U/ a( n' u8 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  l; O7 N, A' Y9 v' @0 H  q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      S1 X3 S# Z% i2 P2 K* s9 z. F- U. C

  67. ( h, S& Z5 K. K! u. v
  68. dma_addr_t dmaphyssrc1 = 0;7 @' v5 b+ }- X! ?1 d
  69. dma_addr_t dmaphyssrc2 = 0;
    ; i9 n  z6 D9 }: S9 T* d" P; f: ?
  70. dma_addr_t dmaphysdest1 = 0;/ ]% j7 k/ T3 m8 {
  71. dma_addr_t dmaphysdest2 = 0;2 N" K; p5 q6 x5 P8 J1 B8 ~! l
  72. 4 x- M5 c  _5 m% K/ h2 M$ O8 z
  73. char *dmabufsrc1 = NULL;, @. d4 \5 p+ Q! q
  74. char *dmabufsrc2 = NULL;
    1 l7 C5 k; x6 P, L- y. o
  75. char *dmabufdest1 = NULL;
    * O$ j3 i; H1 O+ A& v/ R
  76. char *dmabufdest2 = NULL;
    0 g0 i1 e# l3 c5 V
  77. 2 v9 z" A& v+ h0 ?- a
  78. static int acnt = 512;+ c! V, K" D; r) \  N* v3 k
  79. static int bcnt = 8;* G- p7 k. J8 P: c
  80. static int ccnt = 8;
    9 v6 b' C9 p7 V

  81. " ?: c2 x! |5 }" G; d* I
  82. module_param(acnt, int, S_IRUGO);
    ) X1 e7 F' c* |
  83. module_param(bcnt, int, S_IRUGO);6 D- V; q1 n6 @2 K+ S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  \4 Z! o& X$ U# w3 O0 ]! z4 A7 L) V, J- B. W* j4 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' \  [5 B: _  M1 C5 h; i& jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' l! I/ X% b4 W9 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 D5 w5 P. Q5 Y  q" U: |2 ?. ~0 E* p8 \) @8 T  [

0 O# `% d. `( k( X1 R4 `4 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 00:22 , Processed in 0.038197 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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