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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. W: @* ]: Y, O( S
  1. [code]EDMA sample test application. G$ _  L) a; I; u
  2. /*# H1 ?" A2 U) @0 X, F+ h3 k7 O$ G. C
  3. * edma_test.c  q  J' U# u4 [4 C8 b
  4. *
    $ f6 D/ x& d2 s  g+ [
  5. * brief  EDMA3 Test Application
    7 Y8 T1 N8 `$ C
  6. *
    8 P7 |8 N8 \% U' O% p) f2 T! z
  7. *   This file contains EDMA3 Test code.
    / c- U$ g0 y* E
  8. *
    9 y' |" w( j4 o: E: N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; E9 t# i% K! ]2 A9 P$ T- G  w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ q+ K. t- N1 h7 a. v
  11. *         TO CHANGE.
    3 t3 u; K6 ?# x1 ]; e; h- _4 |
  12. *
    2 B, k+ y9 u4 U1 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % o/ `( \' v. r! j4 n
  14. *0 n9 S) L6 K' e3 j1 R) m
  15. * This program is free software; you can redistribute it and/or
    1 ?- z& i& Y! K( ~
  16. * modify it under the terms of the GNU General Public License as
    3 K, G, A+ I; G9 T* A
  17. * published by the Free Software Foundation version 2.
    ( R" p7 i' q+ F8 d8 O
  18. *
    . g; y% E8 j4 z, F2 r3 X* V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - o5 X7 v; l' \
  20. * kind, whether express or implied; without even the implied warranty
    ! S; w4 k+ K" f9 N" f7 O% `7 y/ H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, z% n/ f# N. r8 d2 B/ Y
  22. * GNU General Public License for more details.
    0 y8 C: ?) N1 T8 j
  23. */
    ; _7 d1 M% @- _; |8 G: e
  24. - R6 L1 _! j. J
  25. #include <linux/module.h>' P  w9 l: I: b( E
  26. #include <linux/init.h>1 k2 F; Q& [: A2 y9 q
  27. #include <linux/errno.h>& w) J+ b& l  S2 h
  28. #include <linux/types.h>* R. |2 B! ~: K2 }
  29. #include <linux/interrupt.h>/ j) Y5 [$ {8 f% E# r3 u# P
  30. #include <asm/io.h>* }! B) u) w. j+ r5 S5 a' E9 f9 D
  31. #include <linux/moduleparam.h>
    . v8 q* U7 S9 y6 e  e! E
  32. #include <linux/sysctl.h>
    3 a  o& [. H' T, z4 c
  33. #include <linux/mm.h>
    7 M/ P, S$ f# L
  34. #include <linux/dma-mapping.h>
    + g+ U& X$ ~. U& s4 l: U- _& @/ `( t

  35. 8 V/ H8 T$ C1 c. P/ ?; F( \" x2 g8 _
  36. #include <mach/memory.h>
    * e- Q, J6 G* Y3 g. A' X
  37. #include <mach/hardware.h>
    : _0 r  ?0 e. Y. [
  38. #include <mach/irqs.h>
    9 s0 k. R6 z) @; U* Q
  39. #include <asm/hardware/edma.h>
    " J; ^8 p9 S& i

  40. " J: d( y) j, f9 O
  41. #undef EDMA3_DEBUG9 a8 T- \9 j' I+ g& ^' t0 j3 @
  42. /*#define EDMA3_DEBUG*/
    3 X, ?& s2 E2 S7 G/ V

  43. - J8 s4 q) `4 `6 r: S. _- o
  44. #ifdef EDMA3_DEBUG
    1 x3 A: t/ c) \. y) j6 t4 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) E0 U% T# T; L6 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  `( h4 l- M5 s* \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 G; A$ L  F5 O, ~
  48. #else
    4 x: O' s6 G) _" N
  49. #define DMA_PRINTK( x... )
    3 {) I; l. G* ^0 D* H6 _  o& o
  50. #define DMA_FN_IN
    9 l3 X- Z( G0 P, T
  51. #define DMA_FN_OUT* Z* R8 T9 m& Q5 D
  52. #endif7 X7 C( B' K) `
  53. ; t. c$ R" M% g0 ~, ~7 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . R8 K# m# A& U" ^9 |+ Z9 m5 q
  55. #define STATIC_SHIFT                3
    " R* |6 g, _5 [
  56. #define TCINTEN_SHIFT               20
    * j5 ~; ~) R; F2 M' T$ y0 w) T+ {. \" q
  57. #define ITCINTEN_SHIFT              216 f4 R, e" i- r
  58. #define TCCHEN_SHIFT                22
    4 U  b) d5 @$ z. Q, X& [. M
  59. #define ITCCHEN_SHIFT               23# \1 }  L9 I( T& w' J" }# [

  60. & w5 j4 g0 u5 N, Q0 A8 d
  61. static volatile int irqraised1 = 0;
    ( N4 [* H" S: Q4 ]
  62. static volatile int irqraised2 = 0;2 M+ l) K( ?* p" S3 J
  63. 4 Q8 P# n% h8 ?; s# @( \7 p* G6 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , v3 o1 s3 F! Z4 Y6 {6 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ]: {' V: s0 B( B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& n, p0 q; g) Y

  67. 5 E8 [. J( J# E- n; T2 @
  68. dma_addr_t dmaphyssrc1 = 0;
    4 Q: S3 M$ R/ S
  69. dma_addr_t dmaphyssrc2 = 0;. f: H6 b: m; d; ~! i' T
  70. dma_addr_t dmaphysdest1 = 0;& F; C8 J0 i4 p: }
  71. dma_addr_t dmaphysdest2 = 0;0 U7 Q3 h$ {" I9 ]- ?

  72.   d5 X8 o6 n) A4 H
  73. char *dmabufsrc1 = NULL;
    ( E3 h. ~3 c$ T, ~  }7 S; U8 E: t, a
  74. char *dmabufsrc2 = NULL;+ s; t, _7 }# J3 X
  75. char *dmabufdest1 = NULL;
    ( a5 |6 G7 L/ g- K3 L6 s9 }# j
  76. char *dmabufdest2 = NULL;
    4 c. W5 ~8 @2 B. F) ?. Y; h

  77. 5 n9 x6 ]: a) U3 N$ _) D+ x6 h
  78. static int acnt = 512;
    . e! A" Y) d. U9 j) s. d. N5 r
  79. static int bcnt = 8;2 C( Q1 w# a5 @4 }
  80. static int ccnt = 8;
    . V# u" h3 u- z5 O* Y( A( S# \

  81. 0 l; I* y7 B) q9 A9 x% r! G
  82. module_param(acnt, int, S_IRUGO);7 v$ t3 o8 M8 s4 }: U
  83. module_param(bcnt, int, S_IRUGO);
    + A' u& L" F9 x9 s* q1 f# ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( U1 I7 C+ E/ V/ u! d) O" y) n; ~" g7 a5 s" P. q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ B8 I( t7 W  d% rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 {6 H# _( u) x( q2 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 {/ k; ?2 i, Z, {
7 k$ g% k* ]) G* B" {7 @4 ?# I8 t! }- Q6 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 17:50 , Processed in 0.039213 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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