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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # T, r. [* D( |; g
  1. [code]EDMA sample test application
    ' q: g; t8 D2 |, b! g4 I1 Y
  2. /*
    " J' O6 w3 v( u/ B9 w7 g
  3. * edma_test.c+ x: h5 K% ?1 U% Q! x8 B
  4. *! v; {1 B3 Z9 R% ?9 [5 q
  5. * brief  EDMA3 Test Application
    ! o+ M- d. Z! {
  6. *
    9 c0 c0 b: Q2 |& T) t
  7. *   This file contains EDMA3 Test code.
    : ~1 ^  H( i2 R/ I& |4 F
  8. *2 i2 F$ Y" n) k( _! ]" t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 ]( m# H+ g# [/ S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 L( u; a9 G2 E, I" k5 @0 u
  11. *         TO CHANGE.4 @8 _- I8 _  M" i9 T& e+ s
  12. *
    ; z# r. d& [& t4 ]8 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 r9 X6 \* [: _0 l2 Q* M* ^. E5 z
  14. *
    4 t, u! F& j# K. r6 R# W0 |1 r' p
  15. * This program is free software; you can redistribute it and/or
    3 i( s6 }& b* `5 s0 U
  16. * modify it under the terms of the GNU General Public License as
    % \) K2 k9 p  l  b' @4 `& [
  17. * published by the Free Software Foundation version 2.
    ) Q: J6 q, l. K  G2 P- L: q
  18. *
    8 {( l" R8 _( ?. ?: Z- X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# y1 `8 g  W  P6 U: u/ N& X4 p
  20. * kind, whether express or implied; without even the implied warranty
    / }( S4 S! r9 E3 I5 P5 g6 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 ?" H- }! W5 L3 k7 p
  22. * GNU General Public License for more details.
    7 [; j3 x6 S- Q6 k3 R8 ?
  23. */
    2 T; c: z: [  \, g
  24. * F" }8 l: Z! n' k+ [" E7 u9 Q
  25. #include <linux/module.h>
    $ O0 Y+ W4 {5 ^% E+ \, N- `
  26. #include <linux/init.h>
    . N/ F4 G+ \! w/ `( g
  27. #include <linux/errno.h>
    7 b/ N7 S, |* i$ ^$ `: \
  28. #include <linux/types.h>1 Q% T9 E/ U5 M, [
  29. #include <linux/interrupt.h>
    8 @7 P+ L  R2 _3 n  ^
  30. #include <asm/io.h>! m4 |- d) t; `- h
  31. #include <linux/moduleparam.h>
      c- O7 P+ M+ Q; b7 E5 ^/ `
  32. #include <linux/sysctl.h>
    $ ^# Q% ?+ ~# ~
  33. #include <linux/mm.h>, f) y) ^# J! f$ G4 O# i; v
  34. #include <linux/dma-mapping.h>
    - F; ~" y* I; M2 o) d7 d% T" }
  35. 2 Y& b4 }5 _1 [* w
  36. #include <mach/memory.h>' @* u. m' M, z$ \  u
  37. #include <mach/hardware.h>; E" H- B- b4 V9 _
  38. #include <mach/irqs.h>  a1 k. H# b1 U1 b% V) q8 k
  39. #include <asm/hardware/edma.h>
    & q  I1 U1 w/ D
  40.   C/ e5 y; k1 g
  41. #undef EDMA3_DEBUG
    : N# r) ?1 ^; C
  42. /*#define EDMA3_DEBUG*/
    $ d* M' ^4 y5 y7 m; h$ M
  43. ; A+ T4 x. l8 b2 U$ X7 ?3 W
  44. #ifdef EDMA3_DEBUG
    & t. _7 m* U$ n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 d9 s" N4 s: c8 B( b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% E8 J3 X3 T) J2 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + ~* y' `6 R; }6 Z* d% L+ G
  48. #else" `" ^8 M9 J* _2 \7 {$ ]  H$ i5 ], h
  49. #define DMA_PRINTK( x... )& L" g4 H% m1 @. _3 P4 ^4 B2 k
  50. #define DMA_FN_IN& g3 x: C& B* y5 w/ h, b
  51. #define DMA_FN_OUT
    ; v" }2 ?- V/ D2 G
  52. #endif5 e9 m# N# \, s

  53.   Y3 M' K9 v7 K* o1 u9 g9 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% B8 ?8 N7 S: D! a9 @$ y
  55. #define STATIC_SHIFT                3( `" ~% K* v# `0 z! `
  56. #define TCINTEN_SHIFT               20
    : I3 q; ]  J! {
  57. #define ITCINTEN_SHIFT              21
    + |1 K$ X7 y  b3 S$ V
  58. #define TCCHEN_SHIFT                22* t* G7 e6 b8 k8 J- k
  59. #define ITCCHEN_SHIFT               231 t" w8 J1 B% l6 p- y6 y5 p

  60. 9 B. q0 |" J* L2 d, N; k
  61. static volatile int irqraised1 = 0;- W9 y! K/ f8 M8 K/ i9 {+ X/ O7 y
  62. static volatile int irqraised2 = 0;# h# w+ j& Q3 D# t0 p) g: v' q
  63. 7 y, J0 x4 D* V- s% }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 K2 U1 R4 g+ x& J4 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ~% J1 O( S3 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; y- F+ u  ~4 k( h9 J3 R3 v
  67. : J' z4 W( F) ?' }
  68. dma_addr_t dmaphyssrc1 = 0;
    , z$ I4 ^+ @" Y& d; j
  69. dma_addr_t dmaphyssrc2 = 0;2 S/ c; |9 K2 f% s4 Y
  70. dma_addr_t dmaphysdest1 = 0;8 t1 C5 p3 m6 c1 \: W5 c
  71. dma_addr_t dmaphysdest2 = 0;0 O5 w% z4 G- @+ Q6 ?( y
  72. % f/ I( f6 r% T# |9 [
  73. char *dmabufsrc1 = NULL;
    : I9 k, `8 Z  B; U% g
  74. char *dmabufsrc2 = NULL;
    : x: k8 R$ e3 L" n" q
  75. char *dmabufdest1 = NULL;; M( _. S$ f# b& v4 C7 D" F! m0 r
  76. char *dmabufdest2 = NULL;
      X( M6 V$ [# C' c( y5 O, {/ ~8 K
  77. , }+ F" F9 S. Z/ v
  78. static int acnt = 512;) m  m. k) w  H. j4 M: ?2 Y+ B1 F9 D5 [
  79. static int bcnt = 8;
    , t# m; ]; Y" ]6 b' L2 o& d+ [$ X
  80. static int ccnt = 8;
    ; K$ E5 ?# P  f7 c
  81. 6 ^) V0 T# `: g& U
  82. module_param(acnt, int, S_IRUGO);5 c& W7 X# E; t1 G. `  m8 \0 x
  83. module_param(bcnt, int, S_IRUGO);
    ) I/ @/ V- M$ S. M4 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 y! p1 ]' t6 U  Y; P

8 G! l% p6 P2 P- ~# \1 Q4 R) f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 u- |5 \. N. n* t# p$ o
arm-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 N6 ?- X/ O4 t2 E7 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ {* w  b* G4 [" i* P9 b; |
( M4 L6 \6 K+ I2 h4 D) F
1 X& \9 u8 Q. Q$ j  e5 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 10:58 , Processed in 0.040861 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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